Class: NewRelic::Agent::WorkerLoop::LoopTask
- Defined in:
- lib/new_relic/agent/worker_loop.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(call_period, desc = "", &task_proc) ⇒ LoopTask
constructor
A new instance of LoopTask.
- #next_invocation_time ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(call_period, desc = "", &task_proc) ⇒ LoopTask
Returns a new instance of LoopTask.
99 100 101 102 103 104 |
# File 'lib/new_relic/agent/worker_loop.rb', line 99 def initialize(call_period, desc="", &task_proc) @call_period = call_period @last_invocation_time = Time.now @task = task_proc @desc = desc end |
Instance Method Details
#execute ⇒ Object
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_time ⇒ Object
108 109 110 |
# File 'lib/new_relic/agent/worker_loop.rb', line 108 def next_invocation_time @last_invocation_time + @call_period end |
#to_s ⇒ Object
105 106 107 |
# File 'lib/new_relic/agent/worker_loop.rb', line 105 def to_s "Task[#{@desc}]" end |