mirror of https://github.com/go-redis/redis.git
feat(option): default dialtimeout take effect when dialer is nil
This commit is contained in:
parent
f3d06886e6
commit
d184d958d7
|
@ -120,6 +120,9 @@ func (opt *Options) init() {
|
|||
opt.Network = "tcp"
|
||||
}
|
||||
}
|
||||
if opt.DialTimeout == 0 {
|
||||
opt.DialTimeout = 5 * time.Second
|
||||
}
|
||||
if opt.Dialer == nil {
|
||||
opt.Dialer = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
netDialer := &net.Dialer{
|
||||
|
@ -135,9 +138,6 @@ func (opt *Options) init() {
|
|||
if opt.PoolSize == 0 {
|
||||
opt.PoolSize = 10 * runtime.NumCPU()
|
||||
}
|
||||
if opt.DialTimeout == 0 {
|
||||
opt.DialTimeout = 5 * time.Second
|
||||
}
|
||||
switch opt.ReadTimeout {
|
||||
case -1:
|
||||
opt.ReadTimeout = 0
|
||||
|
|
Loading…
Reference in New Issue