Commit 46469490 authored by Ismael Posada Trobo's avatar Ismael Posada Trobo
Browse files

Allow plugins to register demon processes...

Allow plugins to register demon processes (https://github.com/discourse/discourse/commit/1d024f77a614177bf2cdaa18f7518b35eb5423fb)
parent aa4413cc
...@@ -84,7 +84,7 @@ before_fork do |server, worker| ...@@ -84,7 +84,7 @@ before_fork do |server, worker|
sidekiqs = ENV['UNICORN_SIDEKIQS'].to_i sidekiqs = ENV['UNICORN_SIDEKIQS'].to_i
if sidekiqs > 0 if sidekiqs > 0
puts "Starting up #{sidekiqs} supervised sidekiqs" server.logger.info "starting #{sidekiqs} supervised sidekiqs"
require 'demon/sidekiq' require 'demon/sidekiq'
Demon::Sidekiq.after_fork do Demon::Sidekiq.after_fork do
...@@ -107,7 +107,7 @@ before_fork do |server, worker| ...@@ -107,7 +107,7 @@ before_fork do |server, worker|
end end
if ENV['DISCOURSE_ENABLE_EMAIL_SYNC_DEMON'] == 'true' if ENV['DISCOURSE_ENABLE_EMAIL_SYNC_DEMON'] == 'true'
puts "Starting up EmailSync demon" server.logger.info "starting up EmailSync demon"
Demon::EmailSync.start Demon::EmailSync.start
Signal.trap("SIGTSTP") do Signal.trap("SIGTSTP") do
STDERR.puts "#{Time.now}: Issuing stop to EmailSync" STDERR.puts "#{Time.now}: Issuing stop to EmailSync"
...@@ -115,6 +115,11 @@ before_fork do |server, worker| ...@@ -115,6 +115,11 @@ before_fork do |server, worker|
end end
end end
DiscoursePluginRegistry.demon_processes.each do |demon_class|
server.logger.info "starting #{demon_class.prefix} demon"
demon_class.start
end
class ::Unicorn::HttpServer class ::Unicorn::HttpServer
alias :master_sleep_orig :master_sleep alias :master_sleep_orig :master_sleep
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment