lib/new_relic/agent/agent.rb in newrelic_rpm-2.9.8 vs lib/new_relic/agent/agent.rb in newrelic_rpm-2.9.9
- old
+ new
@@ -196,10 +196,12 @@
else
launch_worker_thread
# When the VM shuts down, attempt to send a message to the
# server that this agent run is stopping, assuming it has
# successfully connected
- at_exit { shutdown }
+ # This shutdown handler doesn't work if Sinatra or Unicorn is running
+ # because it executes in the shutdown handler!
+ at_exit { shutdown } unless [:sinatra, :unicorn].include? NewRelic::Control.instance.dispatcher
end
end
control.log! "New Relic RPM Agent #{NewRelic::VERSION::STRING} Initialized: pid = #{$$}"
control.log! "Agent Log found in #{NewRelic::Control.instance.log_file}" if NewRelic::Control.instance.log_file
end