add comment about ZPOPMIN

This commit is contained in:
Brian Gough 2019-09-26 15:18:10 +01:00
parent a709a0adaa
commit ba35c73cb6

View file

@ -305,6 +305,7 @@ module.exports = RedisManager =
return callback() if !reply?.length # return if no projects ready to be processed return callback() if !reply?.length # return if no projects ready to be processed
# pop the oldest entry (get and remove in a multi) # pop the oldest entry (get and remove in a multi)
multi = rclient.multi() multi = rclient.multi()
# Poor man's version of ZPOPMIN, which is only available in Redis 5.
multi.zrange keys.flushAndDeleteQueue(), 0, 0, "WITHSCORES" multi.zrange keys.flushAndDeleteQueue(), 0, 0, "WITHSCORES"
multi.zremrangebyrank keys.flushAndDeleteQueue(), 0, 0 multi.zremrangebyrank keys.flushAndDeleteQueue(), 0, 0
multi.zcard keys.flushAndDeleteQueue() # the total length of the queue (for metrics) multi.zcard keys.flushAndDeleteQueue() # the total length of the queue (for metrics)