DEV: Force ActiveRecord reading role on Redis failover take 2.

This commit is contained in:
Guo Xiang Tan 2020-07-20 16:11:20 +08:00
parent 5adf2ccaca
commit 383537a2fa
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -56,8 +56,8 @@ if defined?(RailsFailover::ActiveRecord)
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]
GlobalSetting.redis_config[:replica_host] &&
Discourse.redis.connection[:host] == GlobalSetting.redis_config[:replica_host]
)
rescue => e
if e.is_a?(Redis::CannotConnectError)