mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 03:12:46 +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
|
||||
begin
|
||||
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)
|
||||
logger.warn "#{log_prefix}: Master server is active, killing all connections to slave..."
|
||||
slave_client.call([:client, [:kill, 'type', 'normal']])
|
||||
Discourse.clear_readonly!
|
||||
Discourse.request_refresh!
|
||||
|
@ -62,6 +64,14 @@ class DiscourseRedis
|
|||
def synchronize
|
||||
@mutex.synchronize { yield }
|
||||
end
|
||||
|
||||
def logger
|
||||
Rails.logger
|
||||
end
|
||||
|
||||
def log_prefix
|
||||
"#{self.class}"
|
||||
end
|
||||
end
|
||||
|
||||
class Connector < Redis::Client::Connector
|
||||
|
|
Loading…
Reference in New Issue
Block a user