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-4.2.0-java lib/appsignal/hooks/celluloid.rb
appsignal-4.2.0 lib/appsignal/hooks/celluloid.rb
appsignal-4.1.3-java lib/appsignal/hooks/celluloid.rb
appsignal-4.1.3 lib/appsignal/hooks/celluloid.rb
appsignal-4.1.2-java lib/appsignal/hooks/celluloid.rb
appsignal-4.1.2 lib/appsignal/hooks/celluloid.rb
appsignal-4.1.1-java lib/appsignal/hooks/celluloid.rb
appsignal-4.1.1 lib/appsignal/hooks/celluloid.rb
appsignal-4.1.0-java lib/appsignal/hooks/celluloid.rb
appsignal-4.1.0 lib/appsignal/hooks/celluloid.rb
appsignal-4.0.9-java lib/appsignal/hooks/celluloid.rb
appsignal-4.0.9 lib/appsignal/hooks/celluloid.rb
appsignal-4.0.8-java lib/appsignal/hooks/celluloid.rb
appsignal-4.0.8 lib/appsignal/hooks/celluloid.rb
appsignal-4.0.7-java lib/appsignal/hooks/celluloid.rb
appsignal-4.0.7 lib/appsignal/hooks/celluloid.rb
appsignal-4.0.6-java lib/appsignal/hooks/celluloid.rb
appsignal-4.0.6 lib/appsignal/hooks/celluloid.rb
appsignal-4.0.5-java lib/appsignal/hooks/celluloid.rb
appsignal-4.0.5 lib/appsignal/hooks/celluloid.rb