skip to Main Content

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:

  1. "test:foo:repeat:7a140b0cf5b3ee29cb164b7c9cc03bc3:1619132310000"
  2. "test:foo:repeat:7a140b0cf5b3ee29cb164b7c9cc03bc3:1619132280000"
  3. "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


  1. Chosen as BEST ANSWER

    Needed to add the 'removeOnComplete' value to the jobOptions.


  2. You can also clean the completed jobs by

    queue.clean(0, 'completed');
    

    Refer to https://github.com/OptimalBits/bull/issues/709#issuecomment-344561983

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search