FIX: Force ActiveRecord reading role if Redis is down take 2.

follow-up f03c7a1ba1
This commit is contained in:
Guo Xiang Tan 2020-07-09 11:14:19 +08:00
parent f03c7a1ba1
commit fd38c2fac3
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -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