Method: NewRelic::Agent::WorkerLoop#run_task

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

#run_taskObject

Executes the block given to the worker loop, and handles errors.


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/new_relic/agent/worker_loop.rb', line 80

def run_task
  if @propagate_errors
    @task.call
  else
    begin
      @task.call
    rescue NewRelic::Agent::ForceRestartException, NewRelic::Agent::ForceDisconnectException
      # blow out the loop
      raise
    rescue => e
      # Don't blow out the stack for anything that hasn't already propagated
      ::NewRelic::Agent.logger.error('Error running task in agent worker loop:', e)
    end
  end
end