Class: NewRelic::Agent::WorkerLoop::LoopTask

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/worker_loop.rb

Instance Method Summary collapse

Constructor Details

#initialize(call_period, &task_proc) ⇒ LoopTask

Returns a new instance of LoopTask.



102
103
104
105
106
# File 'lib/new_relic/agent/worker_loop.rb', line 102

def initialize(call_period, &task_proc)
  @call_period = call_period
  @last_invocation_time = Time.now
  @task = task_proc
end

Instance Method Details

#executeObject



112
113
114
115
# File 'lib/new_relic/agent/worker_loop.rb', line 112

def execute
  @last_invocation_time = Time.now
  @task.call
end

#next_invocation_timeObject



108
109
110
# File 'lib/new_relic/agent/worker_loop.rb', line 108

def next_invocation_time
  @last_invocation_time + @call_period
end