DEV: Redis failover should only clear redis recently readonly.

DEV: Redis failover should only clear redis recently readonly.

diff --git a/config/initializers/002-rails_failover.rb b/config/initializers/002-rails_failover.rb
index 72df0c9..d53451b 100644
--- a/config/initializers/002-rails_failover.rb
+++ b/config/initializers/002-rails_failover.rb
@@ -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
diff --git a/lib/discourse.rb b/lib/discourse.rb
index c46d91e..67ac64c 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -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

GitHub sha: a1c13eb3