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
|
end
|
||||||
|
|
||||||
RailsFailover::Redis.on_fallback do
|
RailsFailover::Redis.on_fallback do
|
||||||
Discourse.clear_readonly!
|
Discourse.clear_redis_readonly!
|
||||||
Discourse.request_refresh!
|
Discourse.request_refresh!
|
||||||
MessageBus.keepalive_interval = message_bus_keepalive_interval
|
MessageBus.keepalive_interval = message_bus_keepalive_interval
|
||||||
end
|
end
|
||||||
|
|
|
@ -518,12 +518,21 @@ module Discourse
|
||||||
postgres_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
postgres_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.clear_postgres_readonly!
|
||||||
|
postgres_last_read_only[Discourse.redis.namespace] = nil
|
||||||
|
end
|
||||||
|
|
||||||
def self.received_redis_readonly!
|
def self.received_redis_readonly!
|
||||||
redis_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
redis_last_read_only[Discourse.redis.namespace] = Time.zone.now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.clear_redis_readonly!
|
||||||
|
redis_last_read_only[Discourse.redis.namespace] = nil
|
||||||
|
end
|
||||||
|
|
||||||
def self.clear_readonly!
|
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!
|
Site.clear_anon_cache!
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue