A platform for community discussion. Free, open, simple.
FIX: Use string for postgres recently readonly DistributedCache (#21040)
Daniel Waterworthc68497159ff2
diff --git a/lib/discourse.rb b/lib/discourse.rbindex 2256998421d..1c7b1a31abe 100644--- a/lib/discourse.rb+++ b/lib/discourse.rb@@ -715,13 +715,10 @@ module Discourseenddef self.postgres_recently_readonly?- timestamp =- postgres_last_read_only.defer_get_set("timestamp") do- seconds = redis.get(LAST_POSTGRES_READONLY_KEY)- Time.zone.at(seconds.to_i) if seconds- end+ seconds =+ postgres_last_read_only.defer_get_set("timestamp") { redis.get(LAST_POSTGRES_READONLY_KEY) }- timestamp.present? && timestamp > 15.seconds.ago+ seconds ? Time.zone.at(seconds.to_i) > 15.seconds.ago : falseenddef self.recently_readonly?