@@ -9,7 +9,8 @@ module Redis::Cluster
99 pass : String ? = nil ,
1010 ssl : Bool = false ,
1111 ssl_context : OpenSSL ::SSL ::Context ::Client ? = nil ,
12- reconnect : Bool = true do
12+ reconnect : Bool = true ,
13+ command_timeout : Time ::Span ? = 10 .seconds do
1314 def host
1415 if @host && @host =~ /:/
1516 raise " invalid hostname: #{ @host } "
@@ -57,7 +58,7 @@ module Redis::Cluster
5758 end
5859 end
5960
60- def copy (host : String ? = nil , port : Int32 ? = nil , sock : String ? = nil , pass : String ? = nil , ssl : Bool ? = nil , ssl_context : OpenSSL ::SSL ::Context ::Client ? = nil , reconnect : Bool ? = nil )
61+ def copy (host : String ? = nil , port : Int32 ? = nil , sock : String ? = nil , pass : String ? = nil , ssl : Bool ? = nil , ssl_context : OpenSSL ::SSL ::Context ::Client ? = nil , reconnect : Bool ? = nil , command_timeout : Time :: Span ? = nil )
6162 Bootstrap .new(
6263 host: host || @host ,
6364 port: port || @port ,
@@ -66,12 +67,13 @@ module Redis::Cluster
6667 ssl: ssl.nil? ? @ssl : ssl,
6768 ssl_context: ssl_context,
6869 reconnect: reconnect.nil? ? @reconnect : reconnect,
70+ command_timeout: command_timeout || @command_timeout ,
6971 )
7072 end
7173
7274 def redis
7375 ssl_ctx = @ssl ? ssl_context : nil
74- Redis .new(host: host, port: port, unixsocket: @sock , password: @pass , ssl: @ssl , ssl_context: ssl_ctx, reconnect: @reconnect , command_timeout: 10 .seconds , connect_timeout: 10 .seconds)
76+ Redis .new(host: host, port: port, unixsocket: @sock , password: @pass , ssl: @ssl , ssl_context: ssl_ctx, reconnect: @reconnect , command_timeout: @command_timeout , connect_timeout: 10 .seconds)
7577 rescue err : Redis ::CannotConnectError
7678 if sock?
7779 raise Redis ::CannotConnectError .new(" file://#{ @sock } " )
0 commit comments