lib/resque/worker.rb
# Attempts to grab a job off one of the provided queues. Returns
# nil if no job can be found.
Attempts to grab a job off one of the provided queues. Returns
nil if no job can be found.
Attempts to grab a job off one of the provided queues . Returns nil if no job can be found .
def reserve(interval = 5.0)
      interval = interval.to_i
      multi_queue = MultiQueue.from_queues(queues)
      if interval < 1
        begin
          queue, job = multi_queue.pop(true)
        rescue ThreadError
          queue, job = nil
        end
      else
        queue, job = multi_queue.poll(interval.to_i)
      end
      Resque.logger.debug "Found job on #{queue}"
      Job.new(queue.name, job) if (queue && job)
    end
def reserve ( interval = 5.0 ) interval = interval . to_i multi_queue = MultiQueue . from_queues ( queues ) if interval < 1 begin queue , job = multi_queue . pop ( true ) rescue ThreadError queue , job = nil end else queue , job = multi_queue . poll ( interval . to_i ) end Resque . logger . debug "Found job on #{queue}" Job . new ( queue . name , job ) if ( queue && job ) end
Attempts to grab a job off one of the provided queues.
Attempts to grab a job off one of the provided queues .
interval