Clear all connections once master recovers.

This commit is contained in:
Guo Xiang Tan 2018-06-12 12:13:59 +08:00
parent c06824e9c2
commit 646ed87aba
2 changed files with 1 additions and 1 deletions

View File

@ -80,6 +80,7 @@ class PostgreSQLFallbackHandler
self.master_up(key) self.master_up(key)
disable_readonly_mode disable_readonly_mode
Sidekiq.unpause! Sidekiq.unpause!
clear_connections
end end
rescue => e rescue => e
logger.warn "#{log_prefix}: Connection to master PostgreSQL server failed with '#{e.message}'" logger.warn "#{log_prefix}: Connection to master PostgreSQL server failed with '#{e.message}'"

View File

@ -36,7 +36,6 @@ describe ActiveRecord::ConnectionHandling do
after do after do
postgresql_fallback_handler.setup! postgresql_fallback_handler.setup!
postgresql_fallback_handler.clear_connections
Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY)
end end