Can I use Sidekiq for continuous processes?

I have several processes that are currently running as rake tasks. Can I somehow use Sidekiq to execute a process in a continuous loop? Is it best practice with Sidekiq?

These processes, although they now run in the background in a continuous cycle in their respective rake tasks, occasionally fail. Then I need to restart the rake task.

I am trying several options using the SO community. One of them is to figure out how to control rake tasks using monit . But this means that each process should have its own environment, adding to the server load. Since I work in a virtualized environment, I want to eliminate this whenever possible.

Another option is to simply use the Sidekiq parameter that I already have. Now I use Sidekiq to process background images, but it is always just one-time. Is there a way that I can have a continuous process in Sidekiq? And also receive notifications about failures and restart processes automatically?

+6
source share
2 answers

The answer to Mike Perham by Sidekiq is to use the cron job for scheduled tasks like this. You can create a rake task that sends a task to Sidekiq to run in the background. Then create a cron job to schedule it.

+2
source

I don’t know why you are going to the side, is this a specific project? I used to face the same problem, but I switched to delayed_job and satisfied my needs. If the active record objects are transactional, using delayed_job otherwise for resque is also good.

+1
source

Source: https://habr.com/ru/post/957144/


All Articles