Skip to content

Instantly share code, notes, and snippets.

@catsby
Created October 17, 2013 14:28
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save catsby/7025955 to your computer and use it in GitHub Desktop.
Save catsby/7025955 to your computer and use it in GitHub Desktop.
Example config/puma.rb file
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