Sha256: 7f250988443d86041c116fe329ca53c9fe2e5ae472d561fdfdef12c5e4ec5ca0

Contents?: true

Size: 589 Bytes

Versions: 3

Compression:

Stored size: 589 Bytes

Contents

if defined?(::Unicorn) && defined?(::Unicorn::HttpServer)
  Appsignal.logger.info('Using Unicorn')

  # We'd love to be able to hook this into Unicorn in a less
  # intrusive way, but this is the best we can do given the
  # options we have.

  class Unicorn::HttpServer
    alias_method :original_worker_loop, :worker_loop

    def worker_loop(worker)
      Appsignal.agent.forked!
      original_worker_loop(worker)
    end
  end

  class Unicorn::Worker
    alias_method :original_close, :close

    def close
      Appsignal.agent.shutdown(true)
      original_close
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appsignal-0.8.0.alpha.0 lib/appsignal/integrations/unicorn.rb
appsignal-0.7.1 lib/appsignal/integrations/unicorn.rb
appsignal-0.7.1.beta.1 lib/appsignal/integrations/unicorn.rb