Suppose the scheduler receives a SIGKILL. If this happens between zrem and zadd in enqueue_job() the repeatable or cron jobs might stop working properly altogether. This is because the job is first consumed from Redis and later added in the sorted set with a score that's the future time at which it will run.
To solve this, I propose using a transaction in enqueue_job. This would assure the atomicity of the sequence of operations.
Suppose the scheduler receives a SIGKILL. If this happens between
zrem
andzadd
inenqueue_job()
the repeatable or cron jobs might stop working properly altogether. This is because the job is first consumed from Redis and later added in the sorted set with a score that's the future time at which it will run.To solve this, I propose using a transaction in
enqueue_job
. This would assure the atomicity of the sequence of operations.