Method: NewRelic::Agent::WorkerLoop#setup

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

#setup(period, task) ⇒ Object

Reset state that is changed by running the worker loop

[View source]

29
30
31
32
33
34
35
36
37
38
# File 'lib/new_relic/agent/worker_loop.rb', line 29

def setup(period, task)
  @task = task
  @period = period if period
  @should_run = true
  @iterations = 0

  now = Process.clock_gettime(Process::CLOCK_REALTIME)
  @deadline = now + @duration if @duration
  @next_invocation_time = (now + @period)
end