Skip to content

Commit

Permalink
Try to reserve another job if the timeout on the previous reserve cal…
Browse files Browse the repository at this point in the history
…l expired
  • Loading branch information
Nicholas Rawlings committed Aug 6, 2014
1 parent a209368 commit 109b795
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/beaneater/job/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ def process!(options={})
reserve_timeout = options.delete(:reserve_timeout) || RESERVE_TIMEOUT
tubes.watch!(*processors.keys)
loop do
job = tubes.reserve(reserve_timeout)
processor = processors[job.tube]
begin
job = tubes.reserve(reserve_timeout)
processor = processors[job.tube]
processor[:block].call(job)
job.delete
rescue AbortProcessingError
break
rescue Beaneater::JobNotReserved, Beaneater::NotFoundError, Beaneater::TimedOutError
retry
rescue *processor[:retry_on]
job.release(:delay => release_delay) if job.stats.releases < processor[:max_retries]
rescue StandardError => e # handles unspecified errors
Expand Down

0 comments on commit 109b795

Please sign in to comment.