lib/new_relic/agent/agent.rb in newrelic_rpm-3.6.5.130 vs lib/new_relic/agent/agent.rb in newrelic_rpm-3.6.6.147

- old
+ new

@@ -472,15 +472,24 @@ end end include Start + def defer_for_delayed_job? + NewRelic::Agent.config[:dispatcher] == :delayed_job && + !NewRelic::DelayedJobInjection.worker_name + end # Check to see if the agent should start, returning +true+ if it should. def agent_should_start? return false if already_started? || disabled? + if defer_for_delayed_job? + ::NewRelic::Agent.logger.debug "Deferring startup for DelayedJob" + return false + end + if defer_for_resque? ::NewRelic::Agent.logger.debug "Deferring startup for Resque in case it daemonizes" return false end @@ -633,9 +642,15 @@ # Try to launch the worker thread and connect to the server. # # See #connect for a description of connection_options. def start_worker_thread(connection_options = {}) + disable = NewRelic::Agent.config[:disable_harvest_thread] + if disable + NewRelic::Agent.logger.info "Not starting Ruby Agent worker thread because :disable_harvest_thread is #{disable}" + return + end + ::NewRelic::Agent.logger.debug "Creating Ruby Agent worker thread." @worker_thread = NewRelic::Agent::AgentThread.new('Worker Loop') do deferred_work!(connection_options) end end