Sha256: 770b264c6bc5f2245072bb3a1943627390011201d204485d8260058a360aed33

Contents?: true

Size: 760 Bytes

Versions: 246

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module Appsignal
  class Hooks
    # @api private
    class CelluloidHook < Appsignal::Hooks::Hook
      register :celluloid

      def dependencies_present?
        defined?(::Celluloid)
      end

      def install
        # Some versions of Celluloid have race conditions while exiting
        # that can result in a dead lock. We stop appsignal before shutting
        # down Celluloid so we're sure our thread does not aggravate this situation.
        # This way we also make sure any outstanding transactions get flushed.

        Celluloid.singleton_class.send(:prepend, Module.new do
          def shutdown
            Appsignal.stop("celluloid")
            super
          end
        end)
      end
    end
  end
end

Version data entries

246 entries across 246 versions & 1 rubygems

Version Path
appsignal-3.0.0-java lib/appsignal/hooks/celluloid.rb
appsignal-3.0.0 lib/appsignal/hooks/celluloid.rb
appsignal-3.0.0.rc.1 lib/appsignal/hooks/celluloid.rb
appsignal-3.0.0.rc.1-java lib/appsignal/hooks/celluloid.rb
appsignal-3.0.0.beta.1 lib/appsignal/hooks/celluloid.rb
appsignal-3.0.0.beta.1-java lib/appsignal/hooks/celluloid.rb