mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Always clear caches after committing the current transaction (#22550)
Instead of having to remember every time, just always wait until the current transaction (if it exists) has committed before clearing any DistributedCache. The only exception to this is caches that aren't caching things from postgres. This means we have to do the test setup after setting the test transaction, because doing the test setup involves clearing caches. Reapplying this - it now doesn't use after_commit if skip_db is set
This commit is contained in:

committed by
GitHub

parent
61aeb2da90
commit
b7404373cf
@ -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
|
||||
postgres_last_read_only.clear(after_commit: false)
|
||||
|
||||
time
|
||||
end
|
||||
|
||||
def self.clear_postgres_readonly!
|
||||
redis.del(LAST_POSTGRES_READONLY_KEY)
|
||||
postgres_last_read_only.clear
|
||||
postgres_last_read_only.clear(after_commit: false)
|
||||
end
|
||||
|
||||
def self.received_redis_readonly!
|
||||
|
Reference in New Issue
Block a user