Skip to content

Instantly share code, notes, and snippets.

@kivanio
Forked from catsby/puma.rb
Created February 7, 2014 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kivanio/8861206 to your computer and use it in GitHub Desktop.
Save kivanio/8861206 to your computer and use it in GitHub Desktop.
preload_app!
min_threads = Integer(ENV['MIN_THREADS'] || 0)
max_threads = Integer(ENV['MAX_THREADS'] || 5)
threads min_threads, max_threads
workers Integer(ENV['WORKER_COUNT'] || 3 )
on_worker_boot do
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 seconds
config['pool'] = ENV['DB_POOL'] || 5
ActiveRecord::Base.establish_connection(config)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment