Sha256: 376e4a526344b523846b0aba4035817ed26916dadddcfee80c880265ffd6f1c0

Contents?: true

Size: 885 Bytes

Versions: 3

Compression:

Stored size: 885 Bytes

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic
  module Agent
    module Shutdown
      # Attempt a graceful shutdown of the agent, flushing any remaining
      # data.
      def shutdown
        return unless started?

        ::NewRelic::Agent.logger.info("Starting Agent shutdown")

        stop_event_loop
        trap_signals_for_litespeed
        untraced_graceful_disconnect
        revert_to_default_configuration

        @started = nil
        Control.reset
      end

      def untraced_graceful_disconnect
        begin
          NewRelic::Agent.disable_all_tracing do
            graceful_disconnect
          end
        rescue => e
          ::NewRelic::Agent.logger.error(e)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-8.13.1 lib/new_relic/agent/agent/shutdown.rb
newrelic_rpm-8.13.0 lib/new_relic/agent/agent/shutdown.rb
newrelic_rpm-8.12.0 lib/new_relic/agent/agent/shutdown.rb