ruby-on-railsrails-activejob

ActiveJob queue limiting


Seems that the task is simple and straightforward: I need to limit amount of jobs that can be performed at the same time, so my server won't blow up. But google is silent, perhaps I'm doing something wrong? Enlighten me please?

I use standard async adapter.


Solution

  • It's not recommended to use default rails async adapter in production, especially for heroku dyno that restart itself once per day.

    For enqueuing and executing jobs in production you need to set up a queuing backend, that is to say you need to decide for a 3rd-party queuing library that Rails should use. Rails itself only provides an in-process queuing system, which only keeps the jobs in RAM. If the process crashes or the machine is reset, then all outstanding jobs are lost with the default async backend. This may be fine for smaller apps or non-critical jobs, but most production apps will need to pick a persistent backend.

    There are plenty of supported adaptor to choose from such as:

    It's easy to start, they provide clear instruction and example.