Method: Delayed::Backend::Base::ClassMethods#reserve
- Defined in:
- lib/delayed/backend/base.rb
permalink #reserve(worker, max_run_time = Worker.max_run_time) ⇒ Object
[View source]
25 26 27 28 29 30 31 |
# File 'lib/delayed/backend/base.rb', line 25 def reserve(worker, max_run_time = Worker.max_run_time) # We get up to 5 jobs from the db. In case we cannot get exclusive access to a job we try the next. # this leads to a more even distribution of jobs across the worker processes find_available(worker.name, 5, max_run_time).detect do |job| job.lock_exclusively!(max_run_time, worker.name) end end |