mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FEATURE: alllow unicorn master to fork sidekiqs, keep alive coming
This commit is contained in:
parent
c6f9cc0787
commit
4aaedb82d0
1 changed files with 17 additions and 0 deletions
|
@ -69,6 +69,23 @@ before_fork do |server, worker|
|
|||
end
|
||||
end
|
||||
|
||||
sidekiqs = ENV['UNICORN_SIDEKIQS'].to_i
|
||||
if sidekiqs > 0
|
||||
puts "Starting up #{sidekiqs} supervised sidekiqs"
|
||||
require 'demon/sidekiq'
|
||||
|
||||
Demon::Sidekiq.start(sidekiqs)
|
||||
|
||||
class ::Unicorn::HttpServer
|
||||
alias :master_sleep_orig :master_sleep
|
||||
|
||||
def master_sleep(sec)
|
||||
Demon::Sidekiq.ensure_running
|
||||
master_sleep_orig(sec)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
ActiveRecord::Base.connection.disconnect!
|
||||
|
|
Loading…
Reference in a new issue