lib/redis-sentinel/client.rb in redis-sentinel-1.1.4 vs lib/redis-sentinel/client.rb in redis-sentinel-1.2.0
- old
+ new
@@ -4,10 +4,11 @@
DEFAULT_FAILOVER_RECONNECT_WAIT_SECONDS = 0.1
class_eval do
def initialize_with_sentinel(options={})
@master_name = fetch_option(options, :master_name)
+ @master_password = fetch_option(options, :master_password)
@sentinels = fetch_option(options, :sentinels)
@failover_reconnect_timeout = fetch_option(options, :failover_reconnect_timeout)
@failover_reconnect_wait = fetch_option(options, :failover_reconnect_wait) ||
DEFAULT_FAILOVER_RECONNECT_WAIT_SECONDS
@@ -68,13 +69,13 @@
rescue Redis::CannotConnectError
try_next_sentinel
end
end
- if is_down == "1" || runid == '?'
+ if is_down.to_s == "1" || runid == '?'
raise Redis::CannotConnectError.new("The master: #{@master_name} is currently not available.")
else
- @options.merge!(:host => host, :port => port.to_i)
+ @options.merge!(:host => host, :port => port.to_i, :password => @master_password)
end
end
private