configurable worker process count for unicorn

This commit is contained in:
Sam 2013-10-30 16:33:08 +11:00
parent a84997ebc7
commit ef2b8cbe5d

View File

@ -3,7 +3,7 @@
discourse_path = File.expand_path(File.expand_path(File.dirname(__FILE__)) + "/../") discourse_path = File.expand_path(File.expand_path(File.dirname(__FILE__)) + "/../")
# tune down if not enough ram # tune down if not enough ram
worker_processes 3 worker_processes (ENV["UNICORN_WORKERS"] || 3).to_i
working_directory discourse_path working_directory discourse_path
@ -41,14 +41,6 @@ before_fork do |server, worker|
I18n.t(:posts) I18n.t(:posts)
# get rid of rubbish so we don't share it # get rid of rubbish so we don't share it
GC.start GC.start
Thread.new do
# sleep a bit, on startup unicorn kills all its children
# so sidestep it
sleep 10
require 'demon/sidekiq'
Demon::Sidekiq.start(1)
end
end end
ActiveRecord::Base.connection.disconnect! ActiveRecord::Base.connection.disconnect!