Method: OFlow::Task#step

Defined in:
lib/oflow/task.rb

#step(max_wait = 5) ⇒ Object

Causes the Task to process one request and then stop. The max_wait is used to avoid getting stuck if the processing takes too long.

Parameters:

  • max_wait (Float|Fixnum) (defaults to: 5)

    _wait maximum time to wait for the step to complete



276
277
278
279
280
281
282
283
284
285
# File 'lib/oflow/task.rb', line 276

def step(max_wait=5)
  return nil if @loop.nil?
  return nil if STOPPED != @state || @queue.empty?
  @state = STEP
  @step_thread = Thread.current
  @loop.wakeup()
  sleep(max_wait)
  @step_thread = nil
  self
end