FIX: Set master to true before forcing slave connections to reconnect.

This commit is contained in:
Guo Xiang Tan 2016-11-23 14:04:43 +08:00
parent 02025207d5
commit dd4cab3be2
1 changed files with 2 additions and 1 deletions

View File

@ -35,13 +35,14 @@ class DiscourseRedis
if slave_client.call([:info]).split("\r\n").include?(MASTER_LINK_STATUS) if slave_client.call([:info]).split("\r\n").include?(MASTER_LINK_STATUS)
logger.info "#{log_prefix}: Master server is active, killing all connections to slave..." logger.info "#{log_prefix}: Master server is active, killing all connections to slave..."
self.master = true
CONNECTION_TYPES.each do |connection_type| CONNECTION_TYPES.each do |connection_type|
slave_client.call([:client, [:kill, 'type', connection_type]]) slave_client.call([:client, [:kill, 'type', connection_type]])
end end
Discourse.clear_readonly! Discourse.clear_readonly!
Discourse.request_refresh! Discourse.request_refresh!
self.master = true
success = true success = true
end end
ensure ensure