Class: Barbeque::ExecutionPoller
- Inherits:
-
Object
- Object
- Barbeque::ExecutionPoller
- Defined in:
- lib/barbeque/execution_poller.rb
Instance Method Summary collapse
-
#initialize ⇒ ExecutionPoller
constructor
A new instance of ExecutionPoller.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ ExecutionPoller
Returns a new instance of ExecutionPoller.
5 6 7 |
# File 'lib/barbeque/execution_poller.rb', line 5 def initialize @stop_requested = false end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/barbeque/execution_poller.rb', line 9 def run Barbeque::JobExecution.running.find_in_batches do |job_executions| job_executions.shuffle.each do |job_execution| if @stop_requested return end job_execution.with_lock do if job_execution.running? poll(job_execution) end end end end sleep 1 end |
#stop ⇒ Object
25 26 27 |
# File 'lib/barbeque/execution_poller.rb', line 25 def stop @stop_requested = true end |