Use database url

This commit is contained in:
Wedge 2019-04-06 18:26:11 +03:00
parent 35940128d7
commit d9f2a9f7fb
1 changed files with 1 additions and 9 deletions

View File

@ -12,16 +12,8 @@ on_worker_boot do
if defined?(ActiveRecord::Base) if defined?(ActiveRecord::Base)
ActiveSupport.on_load(:active_record) do ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection
config = Rails.application.config.database_configuration[Rails.env]
# config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
# config['pool'] = ENV['DB_POOL'] || 3
ActiveRecord::Base.establish_connection(config)
Rails.logger.info "Connected to PG. Connection pool size #{config['pool']}, reaping frequency #{config['reaping_frequency']}"
end end
# QC::Conn.connect
Rails.logger.info('Connected to PG') Rails.logger.info('Connected to PG')
end end