A platform for community discussion. Free, open, simple.
DEV: Use existing loggers for stuff we log in `config/unicorn.conf.rb` (#27237)
Alan Guo Xiang Tan47523fa57cf3
diff --git a/config/unicorn.conf.rb b/config/unicorn.conf.rbindex 2c1e43830aa..4bfe1480eef 100644--- a/config/unicorn.conf.rb+++ b/config/unicorn.conf.rb@@ -71,7 +71,7 @@ before_fork do |server, worker|Thread.new dowhile trueunless File.exist?("/proc/#{supervisor}")- puts "Kill self supervisor is gone"+ server.logger.error "Kill self supervisor is gone"Process.kill "TERM", Process.pidendsleep 2@@ -165,11 +165,11 @@ before_fork do |server, worker|"Sidekiq is consuming too much memory (using: %0.2fM) for '%s', restarting" %[(sidekiq_rss.to_f / 1.megabyte), ENV["DISCOURSE_HOSTNAME"]],)+restart = trueendif last_heartbeat < Time.now.to_i - @sidekiq_heartbeat_interval- STDERR.puts "Sidekiq heartbeat test failed, restarting"Rails.logger.warn "Sidekiq heartbeat test failed, restarting"restart = true@@ -218,19 +218,21 @@ before_fork do |server, worker|last_heartbeat_ago =Time.now.to_i - Discourse.redis.get(Demon::EmailSync::HEARTBEAT_KEY).to_iif last_heartbeat_ago > Demon::EmailSync::HEARTBEAT_INTERVAL.to_i- STDERR.puts(+ Rails.logger.warn("EmailSync heartbeat test failed (last heartbeat was #{last_heartbeat_ago}s ago), restarting",)+restart = trueend# Restart process if memory usage is too highemail_sync_rss = max_email_sync_rssif email_sync_rss > max_allowed_email_sync_rss- STDERR.puts(+ Rails.logger.warn("EmailSync is consuming too much memory (using: %0.2fM) for '%s', restarting" %[(email_sync_rss.to_f / 1.megabyte), ENV["DISCOURSE_HOSTNAME"]],)+restart = trueend