class Barbeque::ExecutionPoller
Public Class Methods
new(job_queue)
click to toggle source
# File lib/barbeque/execution_poller.rb, line 6 def initialize(job_queue) @job_queue = job_queue @stop_requested = false end
Public Instance Methods
run()
click to toggle source
# File lib/barbeque/execution_poller.rb, line 11 def run @job_queue.job_executions.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()
click to toggle source
# File lib/barbeque/execution_poller.rb, line 27 def stop @stop_requested = true end
Private Instance Methods
poll(job_execution)
click to toggle source
# File lib/barbeque/execution_poller.rb, line 33 def poll(job_execution) Barbeque::ExceptionHandler.set_message_context(job_execution.message_id, nil) executor = Executor.create executor.poll_execution(job_execution) end