Skip to content

Commit

Permalink
fixup! Move scheduling logic to the mlpop lua command
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrochalakis committed Feb 19, 2021
1 parent f8aea2b commit 69e3967
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/resque/data_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def push_to_queue(queue,encoded_item)
# passed to the script (adding a prefix), and we would
# have to reverse map the return values. We avoid that
# by returning the index instead.
def mlpop(*queues, keys:)
@redis.evalsha(mlpop_sha, keys: keys)
def mlpop(*queues)
@redis.evalsha(mlpop_sha, keys: queues)
rescue Redis::CommandError => e
# If the script is not found (e.g. when the server
# is restarted) reload it.
Expand All @@ -154,7 +154,7 @@ def mlpop(*queues, keys:)

def pop_from_queue(*queues)
keys = queues.map { |q| redis_key_for_queue(q) }
key_idx, payload = mlpop(*queues, keys: keys)
key_idx, payload = mlpop(*keys)
return nil if key_idx.nil?

[queues[Integer(key_idx)], payload]
Expand Down

0 comments on commit 69e3967

Please sign in to comment.