mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 08:02:48 +08:00
Add more logging so that we know what is happening with Redis fallback.
This commit is contained in:
parent
8f4bc2228f
commit
1481b3420e
|
@ -27,8 +27,10 @@ class DiscourseRedis
|
||||||
def initiate_fallback_to_master
|
def initiate_fallback_to_master
|
||||||
begin
|
begin
|
||||||
slave_client = ::Redis::Client.new(@slave_config)
|
slave_client = ::Redis::Client.new(@slave_config)
|
||||||
|
logger.warn "#{log_prefix}: Checking connection to master server..."
|
||||||
|
|
||||||
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.warn "#{log_prefix}: Master server is active, killing all connections to slave..."
|
||||||
slave_client.call([:client, [:kill, 'type', 'normal']])
|
slave_client.call([:client, [:kill, 'type', 'normal']])
|
||||||
Discourse.clear_readonly!
|
Discourse.clear_readonly!
|
||||||
Discourse.request_refresh!
|
Discourse.request_refresh!
|
||||||
|
@ -62,6 +64,14 @@ class DiscourseRedis
|
||||||
def synchronize
|
def synchronize
|
||||||
@mutex.synchronize { yield }
|
@mutex.synchronize { yield }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def logger
|
||||||
|
Rails.logger
|
||||||
|
end
|
||||||
|
|
||||||
|
def log_prefix
|
||||||
|
"#{self.class}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Connector < Redis::Client::Connector
|
class Connector < Redis::Client::Connector
|
||||||
|
|
Loading…
Reference in New Issue
Block a user