Hey,
I see that the Redis datafile gets bigger and bigger because he saves all processed jobs. How can I delete those finished jobs from Redis?
As developer, you can decide which and when you want to clean your processed jobs and failed jobs.
Here a quick code to automaticly remove processed jobs and report failed jobs on a given queue.
queue.on('completed', function (job) {
//Job finished we remove it
job.remove();
});
queue.on('failed', function(job, err) {
//Unexpected error happen. We report it in our external error handling (rollbar, logentries, mails...) before removing it
yourErrorReporter.handleError(err, job)
job.remove()
});
Thanks, will try that tomorrow!
I don't know why in this issue the options removeOnComplete and removeOnFail weren't mentioned but I leave this comment here just in case somebody needs it like me
https://github.com/OptimalBits/bull/blob/develop/REFERENCE.md#queueadd
@JSilversun the reason is that it is a very old issue and thats why it was not mentioned at the time. But good that you put a reference here in case somebody use the above solution without knowing the newer better way to do it.
Most helpful comment
I don't know why in this issue the options
removeOnCompleteandremoveOnFailweren't mentioned but I leave this comment here just in case somebody needs it like mehttps://github.com/OptimalBits/bull/blob/develop/REFERENCE.md#queueadd