Skip to content

Commit 3b8e1dc

Browse files
author
Aaron Patterson and Terence Lee
committed
call blpop correctly
1 parent 6302902 commit 3b8e1dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/resque/multi_queue.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def pop(non_block = false)
4545
else
4646
queue_names = @queues.map {|queue| queue.redis_name }
4747
synchronize do
48-
value = @pool.with_connection {|pool| pool.blpop(*(queue_names + [1])) } until value
48+
value = @pool.with_connection {|pool| pool.blpop(*(queue_names + [:timeout => 1])) } until value
4949
queue_name, payload = value
5050
queue = @queue_hash[queue_name]
5151
[queue, queue.decode(payload)]
@@ -59,7 +59,7 @@ def pop(non_block = false)
5959
# the timeout expires.
6060
def poll(timeout)
6161
queue_names = @queues.map {|queue| queue.redis_name }
62-
queue_name, payload = @pool.with_connection {|pool| pool.blpop(*(queue_names + [timeout])) }
62+
queue_name, payload = @pool.with_connection {|pool| pool.blpop(*(queue_names + [:timeout => timeout])) }
6363
return unless payload
6464

6565
synchronize do

lib/resque/queue.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def pop non_block = false
7373
raise ThreadError unless value
7474
synchronize {decode value }
7575
else
76-
value = @pool.with_connection {|pool| pool.blpop(@redis_name, 1) } until value
76+
value = @pool.with_connection {|pool| pool.blpop(@redis_name, :timeout => 1) } until value
7777
synchronize {decode value.last }
7878
end
7979
end
@@ -83,7 +83,7 @@ def pop non_block = false
8383
# Blocks for +timeout+ seconds if the queue is empty, and returns nil if
8484
# the timeout expires.
8585
def poll(timeout)
86-
queue_name, payload = @pool.with_connection {|pool| pool.blpop(@redis_name, timeout) }
86+
queue_name, payload = @pool.with_connection {|pool| pool.blpop(@redis_name, :timeout => timeout) }
8787
return unless payload
8888

8989
synchronize do

0 commit comments

Comments
 (0)