Skip to content

Instantly share code, notes, and snippets.

@joenoon
Last active August 29, 2015 13:56
Show Gist options
  • Save joenoon/8848141 to your computer and use it in GitHub Desktop.
Save joenoon/8848141 to your computer and use it in GitHub Desktop.
if defined?(PhusionPassenger)
# Rails.logger is not available at the time of adding the middleware
class PassengerRailsLoggerProxy
def info(*args)
if @logger ||= Rails.logger
@logger.info(*args)
end
end
end
PhusionPassenger.require_passenger_lib 'rack/out_of_band_gc'
# Trigger out-of-band GC every N requests.
config.middleware.use PhusionPassenger::Rack::OutOfBandGc, (ENV['OOB_GC_FREQ'] || 5).to_i, PassengerRailsLoggerProxy.new
GC.disable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment