asciinema.org/config/unicorn.rb
2012-06-09 15:25:43 +02:00

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