Stuck non-repeating repeatable job
Created by: alexkh13
Description
The repeatable job appears to exists in the "repeat" zset but an actual job doesn't exist. The result is that getRepeatableJobs() notifies about a job that isn't happening and is never going to happen. The only option is to remove it and re-add it again.
Test code to reproduce
Couldn't reproduce it. By looking at the code, it seems like an extreme edge case. The only way I see this could happen is if the process was shutdown aggressively right after the zadd finished and couldn't get to the Job.create() in time.
return client
.zadd(_this.keys.repeat, nextMillis, repeatJobKey)
.then(function() {
//
// Generate unique job id for this iteration.
//
var customId = getRepeatJobId(
name,
jobId,
nextMillis,
md5(repeatJobKey)
);
now = Date.now();
var delay = nextMillis - now;
return Job.create(
_this,
name,
data,
_.extend(_.clone(opts), {
jobId: customId,
delay: delay < 0 ? 0 : delay,
timestamp: now,
prevMillis: nextMillis
})
);
});
Bull version
3.3.10