mirror of https://github.com/go-redis/redis.git
Options: Use DialContext by default
Use net.Dialer DialContext by default because go-redis supports contexts. Resolves #1101
This commit is contained in:
parent
e58b0108b1
commit
0ecf16e773
|
@ -112,7 +112,7 @@ func (opt *Options) init() {
|
||||||
KeepAlive: 5 * time.Minute,
|
KeepAlive: 5 * time.Minute,
|
||||||
}
|
}
|
||||||
if opt.TLSConfig == nil {
|
if opt.TLSConfig == nil {
|
||||||
return netDialer.Dial(network, addr)
|
return netDialer.DialContext(ctx, network, addr)
|
||||||
}
|
}
|
||||||
return tls.DialWithDialer(netDialer, opt.Network, opt.Addr, opt.TLSConfig)
|
return tls.DialWithDialer(netDialer, opt.Network, opt.Addr, opt.TLSConfig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,8 @@ var _ = Describe("Client", func() {
|
||||||
Network: "tcp",
|
Network: "tcp",
|
||||||
Addr: redisAddr,
|
Addr: redisAddr,
|
||||||
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
return net.Dial(network, addr)
|
var d net.Dialer
|
||||||
|
return d.DialContext(ctx, network, addr)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue