20 lines
441 B
Ruby
20 lines
441 B
Ruby
worker_processes (ENV['UNICORN_WORKERS'] || 3).to_i
|
|
timeout 30
|
|
preload_app true
|
|
|
|
before_fork do |server, worker|
|
|
if defined?(ActiveRecord::Base)
|
|
ActiveRecord::Base.connection.disconnect!
|
|
Rails.logger.info('Disconnected from ActiveRecord')
|
|
end
|
|
|
|
sleep 1
|
|
end
|
|
|
|
after_fork do |server, worker|
|
|
if defined?(ActiveRecord::Base)
|
|
ActiveRecord::Base.establish_connection
|
|
Rails.logger.info('Connected to ActiveRecord')
|
|
end
|
|
end
|