• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Background jobs with Rails 8 are delightful

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Article originally published here (image doesn't work well here) :


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



There's one thing I forgot to mention about

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

last time : it's how background jobs are handled in Rails 8.

Example


Here's what it looks like on my current project :

(image)

Background jobs should be a default feature


Most web frameworks completely underestimate how background jobs are valuable.

Honestly I always need a way to handle background jobs, on every new web project.

  • Forgot password email ? => background task to send the email
  • Clean image asynchronously ? => background task to clean the image

And so on.

IMHO A good way go see if a framework is mature enough is "are background jobs already included from day 1".

Why it's delightful with Rails 8


Why it is so good with Rails 8?

Because you don't have to care about : it's already included.

From what I've read, it's not possible with other frameworks - outside Laravel.

  • The Database is already backed
  • The Dashboard is already included (!)
  • And, of course, it's damn easy to hook any kind of job inside the framework itself.

All I had to do is to protect the route, so that only the admin can view it.

You don't have to care about internals because it just works


You don't have to care about the JS/CSS, because as long as you keep "propshaft" as gem, it will work.

The beauty (again) is that I don't use propshaft myself. I use Vite.

This is Rails deep integration : even if you don't use the default frontend management, external gem will work with your product.

Two different processes


Of course "background jobs" means "take another thread than the one of the web server".

So there's a tiny configuration locally (Thank you

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.


), and another one for the production, but honestly, it's one line of code that you can forget once properly set up.

Summary


Rails 8 shine not only for the things previously mentionned, but also thanks to mission control.

It gives you very elegant, monitor-able background jobs, right from day one, with full support and upgrades of the Rails maintainers.

Close from silver bullet ;)


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу