Revert "FIX: Always clear caches after committing the current transaction" (#22493)

This reverts commit 8310c7842c.

This was breaking precompilation.
This commit is contained in:
Daniel Waterworth
2023-07-07 18:05:38 -05:00
committed by GitHub
parent 9dd01ca2ef
commit cb794275a7
6 changed files with 17 additions and 24 deletions

View File

@@ -773,14 +773,14 @@ module Discourse
def self.received_postgres_readonly!
time = Time.zone.now
redis.set(LAST_POSTGRES_READONLY_KEY, time.to_i.to_s)
postgres_last_read_only.clear(after_commit: false)
postgres_last_read_only.clear
time
end
def self.clear_postgres_readonly!
redis.del(LAST_POSTGRES_READONLY_KEY)
postgres_last_read_only.clear(after_commit: false)
postgres_last_read_only.clear
end
def self.received_redis_readonly!

View File

@@ -19,12 +19,4 @@ class DistributedCache < MessageBus::DistributedCache
self.defer_set(k, value)
value
end
def clear(after_commit: true)
if after_commit
DB.after_commit { super() }
else
super()
end
end
end