Skip to content

Commit 34305a6

Browse files
committed
When connecting to different servers, update our connection details.
Bug reported by @badboy on #474.
1 parent e341abd commit 34305a6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/redis/client.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,12 @@ def logging(commands)
308308
end
309309

310310
def establish_connection
311-
@connection = @options[:driver].connect(@connector.resolve.dup)
311+
server = @connector.resolve.dup
312+
313+
@options[:host] = server[:host]
314+
@options[:port] = server[:port]
315+
316+
@connection = @options[:driver].connect(server)
312317
rescue TimeoutError
313318
raise CannotConnectError, "Timed out connecting to Redis on #{location}"
314319
rescue Errno::ECONNREFUSED

0 commit comments

Comments
 (0)