-
-
Save mpugach/c47c85c0672f645108ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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