DEV: Force ActiveRecord reading role on Redis failover.

This commit is contained in:
Guo Xiang Tan 2020-07-20 15:07:27 +08:00
parent 7f05720e91
commit 5adf2ccaca
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -55,6 +55,9 @@ if defined?(RailsFailover::ActiveRecord)
Discourse.redis.exists?(
Discourse::PG_READONLY_MODE_KEY,
Discourse::PG_FORCE_READONLY_MODE_KEY
) || (
GlobalSetting.redis_config[:replica_port] &&
Discourse.redis.connection[:port] == GlobalSetting.redis_config[:replica_port]
)
rescue => e
if e.is_a?(Redis::CannotConnectError)