seomoz / qless

Queue / Pipeline Management
MIT License
294 stars 76 forks source link

Purge old failed jobs #278

Open NathanBaulch opened 6 years ago

NathanBaulch commented 6 years ago

I've been using Qless in production for over 3 years and have accumulated over 500,000 failed jobs. Is there a "right" way to purge failures older than n days or do I have to roll my sleeves up and write a redis-cli script?

dlecocq commented 6 years ago

The best way is probably to call client.jobs.failed() to get all the failure groups, and then you can use client.jobs.failed(group, offset, count) to get all the associated jobs and then for each job you can make a decision to keep or cancel it.

At least, that's how we've scripted it up in the past.