Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.46k stars 867 forks source link

redis leftover keys #1192

Open roboAmir opened 6 years ago

roboAmir commented 6 years ago

While making sure jobs get finished successfully and being removed, i still see some leftovers in my redis.. After processing one job successfully, i have this on redis:

1) "q:job:1:log"
2) "q:job:1"
3) "q:ids"
4) "q:stats:work-time"
6) "q:job:types"

the 1) and 2) keys seem like lefrovers of the finished job.. after another job more of those are added.. i do remove jobs successfully because otherwise without removing i also see this key - q:jobs:runNewJob:complete

Here's my usage code:

queue.create('runNewJob', {id, anotherId})
      .ttl(SOME_TTL)
      .priority('high')
      .removeOnComplete(true)
      .on('complete', (result) => {
        // some code and logs..
      })
      .on('failed', (err) => {
        // Some logs and code..
      })
      .save();

Maybe those leftovers are supposed to stay there? Cuz after sometime they inflated to over 1 million useless keys!

Thanks a lot!