From e75ad37aaf26dce6fc978860434dd54cb7b75fd9 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 17 Dec 2018 13:28:36 +0800 Subject: [PATCH] FIX: Switch recently readonly mdoe cache to a `DistributedCache`. A per process cache is hard to reason about. During PostgreSQL failovers. The site may bounce in and out of readonly mode depending on which server and process that a request hits. --- lib/discourse.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/discourse.rb b/lib/discourse.rb index c78402b5638..9ea8ef90ee1 100644 --- a/lib/discourse.rb +++ b/lib/discourse.rb @@ -354,7 +354,7 @@ module Discourse end def self.last_read_only - @last_read_only ||= {} + @last_read_only ||= DistributedCache.new('last_read_only', namespace: false) end def self.recently_readonly?