DEV: Pausing Sidekiq is multisite aware.

This commit is contained in:
Guo Xiang Tan 2020-06-04 15:43:40 +08:00
parent 8e1681d356
commit 54f79ea3ba
1 changed files with 2 additions and 4 deletions

View File

@ -15,17 +15,15 @@ if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
RailsFailover::ActiveRecord.on_failover do
RailsMultisite::ConnectionManagement.each_connection do
Discourse.enable_readonly_mode(Discourse::PG_READONLY_MODE_KEY)
Sidekiq.pause!("pg_failover") if !Sidekiq.paused?
end
Sidekiq.pause!("pg_failover") if !Sidekiq.paused?
end
RailsFailover::ActiveRecord.on_fallback do
RailsMultisite::ConnectionManagement.each_connection do
Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY)
Sidekiq.unpause! if Sidekiq.paused?
end
Sidekiq.unpause! if Sidekiq.pause?
end
module Discourse