Created
June 18, 2015 14:58
-
-
Save tal-moshayov/37863c07df5ed6e06b0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workers Integer(ENV['PUMA_WORKERS'] || 2) | |
threads Integer(ENV['PUMA_MIN_THREADS'] || 1), Integer(ENV['PUMA_MAX_THREADS'] || 6) | |
preload_app! | |
port ENV['PUMA_PORT'] || 3000 | |
environment ENV['RACK_ENV'] || 'development' | |
on_worker_boot do | |
puts 'Puma on_worker_boot: Reconnecting ActiveRecord' | |
ActiveSupport.on_load(:active_record) do | |
config = ActiveRecord::Base.configurations[Rails.env] || | |
Rails.application.config.database_configuration[Rails.env] | |
config['pool'] = ENV['PUMA_MAX_THREADS'] || 6 | |
ActiveRecord::Base.establish_connection(config) | |
end | |
Redis.client.reconnect unless Redis.current.client.connected? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment