mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:12:45 +08:00
DEV: Redis failover should only clear redis recently readonly.
This commit is contained in:
parent
716629dc0a
commit
a1c13eb3c6
|
@ -10,7 +10,7 @@ if ENV["REDIS_RAILS_FAILOVER"]
|
|||
end
|
||||
|
||||
RailsFailover::Redis.on_fallback do
|
||||
Discourse.clear_readonly!
|
||||
Discourse.clear_redis_readonly!
|
||||
Discourse.request_refresh!
|
||||
MessageBus.keepalive_interval = message_bus_keepalive_interval
|
||||
end
|
||||
|
|
|
@ -518,12 +518,21 @@ module Discourse
|
|||
postgres_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
||||
end
|
||||
|
||||
def self.clear_postgres_readonly!
|
||||
postgres_last_read_only[Discourse.redis.namespace] = nil
|
||||
end
|
||||
|
||||
def self.received_redis_readonly!
|
||||
redis_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
||||
end
|
||||
|
||||
def self.clear_redis_readonly!
|
||||
redis_last_read_only[Discourse.redis.namespace] = nil
|
||||
end
|
||||
|
||||
def self.clear_readonly!
|
||||
postgres_last_read_only[Discourse.redis.namespace] = redis_last_read_only[Discourse.redis.namespace] = nil
|
||||
clear_redis_readonly!
|
||||
clear_postgres_readonly!
|
||||
Site.clear_anon_cache!
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user