kue-scheduler icon indicating copy to clipboard operation
kue-scheduler copied to clipboard

kue-scheduler does not re-schedule unique job if worker dies uncleanly

Open gmcnaught opened this issue 7 years ago • 4 comments

I believe this is due to a change I introduced:

If a unique job is 'active' and the worker that is processing the job becomes unavailable and never calls done(), and doesn't respond to the ttl timeout, the job will be stuck in 'active', and therefore never gets re-scheduled due to:

https://github.com/lykmapipo/kue-scheduler/blob/master/index.js#L56

    var isCompletedOrFailedJob =
      (job.state() === 'complete' ||
        job.state() === 'failed');

    if (isCompletedOrFailedJob) {

I will submit a pull request to also check if the last_updated value is older than the job ttl and schedule the next job - this way they do not end up stale.

The only reservation I have about this method is that in a situation where the worker is just unable to talk to redis, it may complete the work twice.

gmcnaught avatar Mar 09 '17 19:03 gmcnaught

appreciated

lykmapipo avatar Mar 16 '17 13:03 lykmapipo

same problem

TangMonk avatar Apr 19 '17 02:04 TangMonk

I think we are having a similar issue here. After we received a timeout error from redis, the unique scheduled job never triggered again.

bilby91 avatar Aug 15 '17 18:08 bilby91

I am having same problem and planning to do this

if Job is timeout Create new job based on the job data. Delete old job.

Is there any logical error on above flow ?

Jageen avatar Jul 03 '18 07:07 Jageen