Sha256: c8c3336770a3cb72f0f0ef8b6fefe1f98dbbf92a295335c67b125a660a2081c9

Contents?: true

Size: 885 Bytes

Versions: 8

Compression:

Stored size: 885 Bytes

Contents

module Honeybadger
  module Integrations
    module Unicorn
      module AfterForkExtension
        def self.included(base)
          base.send(:alias_method, :init_worker_process_without_honeybadger, :init_worker_process)
          base.send(:alias_method, :init_worker_process, :init_worker_process_with_honeybadger)
        end

        def init_worker_process_with_honeybadger(*args, &block)
          init_worker_process_without_honeybadger(*args, &block).tap do
            Honeybadger::Monitor.worker.fork
          end
        end
      end
    end
  end

  Dependency.register do
    requirement { defined?(::Honeybadger::Monitor) }
    requirement { defined?(::Unicorn::HttpServer) }

    injection { Honeybadger.write_verbose_log('Installing Unicorn integration') }
    injection { ::Unicorn::HttpServer.send(:include, Integrations::Unicorn::AfterForkExtension) }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
honeybadger-1.16.7 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.6 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.5 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.4 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.3 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.2 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.1 lib/honeybadger/integrations/unicorn.rb
honeybadger-1.16.0 lib/honeybadger/integrations/unicorn.rb