mirror of
https://github.com/discourse/discourse.git
synced 2025-04-29 05:54:33 +08:00
FIX: Use string for postgres recently readonly DistributedCache (#21040)
Since DistributedCaches don't marshal timestamps
This commit is contained in:
parent
fcc73b441d
commit
c68497159f
@ -715,13 +715,10 @@ module Discourse
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.postgres_recently_readonly?
|
def self.postgres_recently_readonly?
|
||||||
timestamp =
|
seconds =
|
||||||
postgres_last_read_only.defer_get_set("timestamp") do
|
postgres_last_read_only.defer_get_set("timestamp") { redis.get(LAST_POSTGRES_READONLY_KEY) }
|
||||||
seconds = redis.get(LAST_POSTGRES_READONLY_KEY)
|
|
||||||
Time.zone.at(seconds.to_i) if seconds
|
|
||||||
end
|
|
||||||
|
|
||||||
timestamp.present? && timestamp > 15.seconds.ago
|
seconds ? Time.zone.at(seconds.to_i) > 15.seconds.ago : false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.recently_readonly?
|
def self.recently_readonly?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user