Method: NewRelic::Agent::WorkerLoop#run

Defined in:
lib/new_relic/agent/worker_loop.rb

#run(period = nil, &block) ⇒ Object

Run infinitely, calling the registered tasks at their specified call periods. The caller is responsible for creating the thread that runs this worker loop. This will run the task immediately.

[View source]

43
44
45
46
47
48
49
50
51
# File 'lib/new_relic/agent/worker_loop.rb', line 43

def run(period = nil, &block)
  setup(period, block)
  while keep_running?
    sleep_time = schedule_next_invocation
    sleep(sleep_time) if sleep_time > 0
    run_task if keep_running?
    @iterations += 1
  end
end