mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 20:23:44 +08:00
FIX: Clear anon cache when clearing recently readonly.
This commit is contained in:
parent
3359b3baca
commit
b0adffdef5
|
@ -374,6 +374,8 @@ module Discourse
|
||||||
|
|
||||||
def self.clear_readonly!
|
def self.clear_readonly!
|
||||||
last_read_only[$redis.namespace] = nil
|
last_read_only[$redis.namespace] = nil
|
||||||
|
Site.clear_anon_cache!
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.request_refresh!(user_ids: nil)
|
def self.request_refresh!(user_ids: nil)
|
||||||
|
|
|
@ -238,6 +238,20 @@ describe Discourse do
|
||||||
expect(Discourse.last_read_only['default']).to eq(time)
|
expect(Discourse.last_read_only['default']).to eq(time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".clear_readonly!" do
|
||||||
|
it "publishes the right message" do
|
||||||
|
Discourse.received_readonly!
|
||||||
|
messages = []
|
||||||
|
|
||||||
|
expect do
|
||||||
|
messages = MessageBus.track_publish { Discourse.clear_readonly! }
|
||||||
|
end.to change { Discourse.last_read_only['default'] }.to(nil)
|
||||||
|
|
||||||
|
expect(messages.any? { |m| m.channel == Site::SITE_JSON_CHANNEL })
|
||||||
|
.to eq(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#handle_exception" do
|
context "#handle_exception" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user