rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 230 forks source link

What happens when workers are not running? #193

Closed variable closed 5 years ago

variable commented 6 years ago

Say I have scheduler with cron jobs and the queue workers died, would it keep enqueuing jobs so the next time the worker starts will pick up all the jobs?

mindset-team commented 6 years ago

deliberately kill the workers, wait for some jobs to accumulate and restart the workers - this should give you an answer.

as3445 commented 6 years ago

@variable Yes, the scheduler will still enqueue the jobs into a sorted set (which is a score value pair where the score is the time when it needs to be executed) in Redis, and will move the task into a set (RQ uses this to implement the queue) when it is ready to be executed even if the worker is dead. The tasks will accumulate in Redis if the worker is dead, but will be picked up by the worker when it's up again.

variable commented 6 years ago

@as3445 Thanks for the answer, I would have expected the behavior will be the same as Linux cronjob if it couldn't execute the job will just forget it.