I started using the repeatable jobs in bull and everything seems to be working well for me. However, I noticed that each iteration leaves a job in Redis:
- "test:foo:repeat:7a140b0cf5b3ee29cb164b7c9cc03bc3:1619132310000"
- "test:foo:repeat:7a140b0cf5b3ee29cb164b7c9cc03bc3:1619132280000"
- "test:foo:repeat:7a140b0cf5b3ee29cb164b7c9cc03bc3:1619132360000"
and the list keeps growing. I tried to do a job.remove() within the process function, but it threw an error… can’t remove repeatable jobs I guess. I’m assuming these will eventually be cleaned up by Redis, but is there something more proactive I can do to keep Redis clean?
2
Answers
Needed to add the 'removeOnComplete' value to the jobOptions.
You can also clean the completed jobs by
Refer to https://github.com/OptimalBits/bull/issues/709#issuecomment-344561983