Open mmarshak opened 7 years ago
Does somebody have it working?
@mmarshak I have the same problem and I will work to fix it.
Thanks
@mmarshak May please add a fail test(spec) for this so that i can work around your specification.
Appreciated.
Hi @lykmapipo,
As I wrote in my post if I create the job, I expect that cue-scheduler will delete the job when it complete, but it does not.
job = Queue.createJob(type, payload) .attempts(3) .backoff( {delay: 10*1000, type:'fixed'} ) // // back of 10 seconds after each failure .priority('normal') .removeOnComplete(true);
So in my implementation I comment out the - .removeOnComplete(true); And in order to clean the complete job I am listening to Queue events for the event 'job complete', and then I delete the job, which works.
Bellow is the code I use for that -
// Queue events Queue.on('job enqueue', function(id, type){
//console.log( "Queue-Job job# " +id + " got queued of type " + type );
logKue( "Queue-Job job# " +id + " got queued of type " + type );
}).on('job complete', function(id, result){
//console.log("Queue-Job job# " + id + " completed with data " + util.inspect(result));
logKue("Queue-Job job# " + id + " completed with data " + util.inspect(result));
//logKue("Queue-Job job# " + id + " completed ");
// Remove the job upon its completion
kue.Job.get(id, function(err, job){
if (err) {
return;
}
job.remove(function(err){
if (err) {
logError("Failed to remove job %s after it was completed, got an error %s", job.id, util.inspect(err));
}
else {
log('removed completed job #%d', job.id);
//console.log('removed completed job #%d', job.id);
}
});
});
It will be great if the .removeOnComplete(true); was doing it job as it does for the regular Kue. I am sure it will make other people easier.
Thanks
Same problem here.
Any updateon that?
Same problem here.
@rodrigooler Please use latest version. I merged #124. Hope it will fix the issue.
I can not make the job auto removed when complete.
I define the job as - job = Queue.createJob(type, payload) .attempts(3) .backoff( {delay: 10*1000, type:'fixed'} ) // // back of 10 seconds after each failure .priority('normal') .removeOnComplete(true);
And I use schedule to run it one time (not every) but it does not delete the job automatically. When I use just Kue instead it does. Any guidance ?