asciinema.org/config/unicorn.rb
2012-06-10 00:45:45 +02:00

18 lines
430 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
end
after_fork do |server, worker|
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
Rails.logger.info('Connected to ActiveRecord')
end
end