Bull: Clear Redis

Created on 7 Jul 2015  路  4Comments  路  Source: OptimalBits/bull

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?

Most helpful comment

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

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joe-at-startupmedia picture joe-at-startupmedia  路  3Comments

JSRossiter picture JSRossiter  路  3Comments

tdzienniak picture tdzienniak  路  4Comments

thelinuxlich picture thelinuxlich  路  3Comments

btd picture btd  路  3Comments