kue-scheduler
kue-scheduler copied to clipboard
job:undefined when prefix contain colon symbol
When validate expired key, we've already include the prefix, however, when extract the job unique ID, we assume that the expired key has only 3 or 4 parts, therefore, if the prefix contain additional colon symbol, _getJobUUID return undefined value
queue._jobExpiryKeyValidator = new RegExp('^' + queue.options.prefix + ':scheduler:(?!' + lockKey + ')');
var uuid;
var splits = key.split(':');
//deduce job uuid from job expiry key
//kue:scheduler:<jobExpirykey>
if (splits.length === 3) {
uuid = splits[2];
}
//deduce job uuid from job data key
//kue:scheduler:data:<jobExpirykey>
if (splits.length === 4) {
uuid = splits[3];
}
Solution: can we use the last part as UUID ?
var splits = key.split(':');
splits = _.filter(splits, function(o) { return o !== ''; });
if(splits.length > 0){
uuid = splits[splits.length - 1];
}
@vothanhkiet I will appreciate PR.
why did we lock dependencies?
among other things, this locked us into a dangerously-broken version of Redlock (v2.1.1)
@schmod This may solve your problem - https://github.com/lykmapipo/kue-scheduler/pull/101
indeed, it probably would! FWIW, I've had good luck with Redlock 3.0.0.
@schmod I've tried Redlock 3.0.0 with no luck, not sure why :/