FIX: Add enable_email_sync_demon global variable and disable EmailSync demon by default (#10304)
Demon::EmailSync is used in conjunction with the SiteSetting.enable_imap to sync N IMAP mailboxes with specific groups. It is a process started in unicorn.conf, and it spawns N threads (one for each multisite connection) and for each database spans another N threads (one for each configured group). We want this off by default so the process is not started when it does not need to be (e.g. development, test, certain hosting tiers)
This commit is contained in:
parent
1b57276673
commit
a9905ef7e5
|
@ -296,3 +296,12 @@ anon_cache_store_threshold = 2
|
||||||
# list is a comma seperated list of git repos eg:
|
# list is a comma seperated list of git repos eg:
|
||||||
# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git
|
# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git
|
||||||
whitelisted_theme_repos =
|
whitelisted_theme_repos =
|
||||||
|
|
||||||
|
# Demon::EmailSync is used in conjunction with the enable_imap site setting
|
||||||
|
# to sync N IMAP mailboxes with specific groups. It is a process started in
|
||||||
|
# unicorn.conf, and it spawns N threads (one for each multisite connection) and
|
||||||
|
# for each database spans another N threads (one for each configured group).
|
||||||
|
#
|
||||||
|
# We want this off by default so the process is not started when it does not
|
||||||
|
# need to be (e.g. development, test, certain hosting tiers)
|
||||||
|
enable_email_sync_demon = false
|
||||||
|
|
|
@ -104,11 +104,13 @@ before_fork do |server, worker|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "Starting up email sync"
|
if ENV['DISCOURSE_ENABLE_EMAIL_SYNC_DEMON'] == 'true'
|
||||||
Demon::EmailSync.start
|
puts "Starting up EmailSync demon"
|
||||||
Signal.trap("SIGTSTP") do
|
Demon::EmailSync.start
|
||||||
STDERR.puts "#{Time.now}: Issuing stop to email_sync"
|
Signal.trap("SIGTSTP") do
|
||||||
Demon::EmailSync.stop
|
STDERR.puts "#{Time.now}: Issuing stop to EmailSync"
|
||||||
|
Demon::EmailSync.stop
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ::Unicorn::HttpServer
|
class ::Unicorn::HttpServer
|
||||||
|
@ -223,8 +225,10 @@ before_fork do |server, worker|
|
||||||
check_sidekiq_heartbeat
|
check_sidekiq_heartbeat
|
||||||
end
|
end
|
||||||
|
|
||||||
Demon::EmailSync.ensure_running
|
if ENV['DISCOURSE_ENABLE_EMAIL_SYNC_DEMON'] == 'true'
|
||||||
check_email_sync_heartbeat
|
Demon::EmailSync.ensure_running
|
||||||
|
check_email_sync_heartbeat
|
||||||
|
end
|
||||||
|
|
||||||
master_sleep_orig(sec)
|
master_sleep_orig(sec)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue