FIX: Clear anon cache when clearing recently readonly.

FIX: Clear anon cache when clearing recently readonly.

diff --git a/lib/discourse.rb b/lib/discourse.rb
index bc382d7..c8d76f3 100644
--- a/lib/discourse.rb
+++ b/lib/discourse.rb
@@ -374,6 +374,8 @@ module Discourse
 
   def self.clear_readonly!
     last_read_only[$redis.namespace] = nil
+    Site.clear_anon_cache!
+    true
   end
 
   def self.request_refresh!(user_ids: nil)
diff --git a/spec/components/discourse_spec.rb b/spec/components/discourse_spec.rb
index 5263c5f..058b61b 100644
--- a/spec/components/discourse_spec.rb
+++ b/spec/components/discourse_spec.rb
@@ -238,6 +238,20 @@ describe Discourse do
         expect(Discourse.last_read_only['default']).to eq(time)
       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
 
   context "#handle_exception" do

GitHub sha: b0adffde