Sha256: 741dde07987173e466921cc8b5e2858b5bc4a29f614103ec88e0869fab7bb736

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

# encoding: utf-8
# 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

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-8.10.1 lib/new_relic/agent/agent/shutdown.rb
newrelic_rpm-8.10.0 lib/new_relic/agent/agent/shutdown.rb