From fd38c2fac381e5142186f010db3f426079eb067c Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 9 Jul 2020 11:14:19 +0800 Subject: [PATCH] FIX: Force ActiveRecord reading role if Redis is down take 2. follow-up f03c7a1ba1cf --- config/initializers/002-rails_failover.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/002-rails_failover.rb b/config/initializers/002-rails_failover.rb index 7b948c0bd7e..99def934b38 100644 --- a/config/initializers/002-rails_failover.rb +++ b/config/initializers/002-rails_failover.rb @@ -55,10 +55,10 @@ if defined?(RailsFailover::ActiveRecord) Discourse::PG_FORCE_READONLY_MODE_KEY ) rescue => e - unless e.is_a?(Redis::CannotConnectError) - Rails.logger.warn "#{e.class} #{e.message}: #{e.backtrace.join("\n")}" + if e.is_a?(Redis::CannotConnectError) true else + Rails.logger.warn "#{e.class} #{e.message}: #{e.backtrace.join("\n")}" false end end