Skip to content
This repository
Browse code

Bug fix. When calling 'recur on' with a specific jid, but to

a different queue than it was originally put in for, it was causing some
vestigial data to be saved in the old queue. Now this is effectively the
same as a 'move'
  • Loading branch information...
commit 534fac347c245a9a62100586e8ed662039ec6584 1 parent bea9915
Dan Lecocq authored

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. +8 1 recur.lua
9 recur.lua
@@ -35,7 +35,14 @@ if command == 'on' then
35 35 options.priority = assert(tonumber(options.priority or 0) , 'Recur(): Arg "priority" must be a number. Got: ' .. tostring(options.priority))
36 36 options.retries = assert(tonumber(options.retries or 0) , 'Recur(): Arg "retries" must be a number. Got: ' .. tostring(options.retries))
37 37
38   - local count = redis.call('hget', 'ql:r:' .. jid, 'count') or 0
  38 + local count, old_queue = unpack(redis.call('hmget', 'ql:r:' .. jid, 'count', 'queue'))
  39 + count = count or 0
  40 +
  41 + -- If it has previously been in another queue, then we should remove
  42 + -- some information about it
  43 + if old_queue then
  44 + redis.call('zrem', 'ql:q:' .. old_queue .. '-recur', jid)
  45 + end
39 46
40 47 -- Do some insertions
41 48 redis.call('hmset', 'ql:r:' .. jid,

0 comments on commit 534fac3

Please sign in to comment.
Something went wrong with that request. Please try again.