FIX: Don't treat master as up if it is still loading data.

This commit is contained in:
Guo Xiang Tan
2016-11-07 15:28:10 +08:00
parent 9375dcb6fe
commit fbbcde1230
2 changed files with 14 additions and 2 deletions

View File

@ -98,8 +98,8 @@ class DiscourseRedis
options = @options.dup
options.delete(:connector)
client = Redis::Client.new(options)
client.call([:role])
@options
loading = client.call([:info]).split("\r\n").include?("loading:1")
loading ? @slave_options : @options
rescue Redis::ConnectionError, Redis::CannotConnectError, RuntimeError => ex
raise ex if ex.class == RuntimeError && ex.message != "Name or service not known"
@fallback_handler.master = false