lib/resque.rb
# Pops a job off one ore more queues.
#
# queues -  An array of String queue names.
# timeout - Integer number of seconds to block on BLPOP.
#           Defaults to 1, requires a minimum value of 1 to prevent
#           indeterminate blocking.
#
# Returns an array of [queue_name, decoded_payload], or falsey.
Pops a job off one ore more queues.
queues -  An array of String queue names.
timeout - Integer number of seconds to block on BLPOP.
Defaults to 1, requires a minimum value of 1 to prevent
indeterminate blocking.

Returns an array of [queue_name, decoded_payload], or falsey.
Pops a job off one ore more queues . queues - An array of String queue names . timeout - Integer number of seconds to block on BLPOP . Defaults to 1 requires a minimum value of 1 to prevent indeterminate blocking . Returns an array of [ queue_name decoded_payload ] or falsey .
def pop(queues, timeout = 1, retries = 3)
    queue_names = Array(queues).map { |queue| "queue:#{queue}" }
    timeout = [1, timeout].max 
    with_retries(retries: retries) do
      queue, payload = redis.blpop(*queue_names, timeout)
      queue && [queue.sub("queue:", ""), decode(payload)]
    end
  end
def pop ( queues , timeout = 1 , retries = 3 ) queue_names = Array ( queues ) . map { | queue | "queue:#{queue}" } timeout = [ 1 , timeout ] . max with_retries ( retries : retries ) do queue , payload = redis . blpop ( * queue_names , timeout ) queue && [ queue . sub ( "queue:" , "" ) , decode ( payload ) ] end end
Pops a job off one ore more queues.
Pops a job off one ore more queues .
# require nonzero, no infinite blocking
queues
timeout
retries