mirror of https://github.com/go-redis/redis.git
parent
b7720fd8e7
commit
0b855ecda5
11
sentinel.go
11
sentinel.go
|
@ -219,14 +219,21 @@ func masterSlaveDialer(
|
||||||
failover.trySwitchMaster(ctx, addr)
|
failover.trySwitchMaster(ctx, addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if failover.opt.Dialer != nil {
|
if failover.opt.Dialer != nil {
|
||||||
return failover.opt.Dialer(ctx, network, addr)
|
return failover.opt.Dialer(ctx, network, addr)
|
||||||
}
|
}
|
||||||
return net.DialTimeout("tcp", addr, failover.opt.DialTimeout)
|
|
||||||
|
netDialer := &net.Dialer{
|
||||||
|
Timeout: failover.opt.DialTimeout,
|
||||||
|
KeepAlive: 5 * time.Minute,
|
||||||
|
}
|
||||||
|
if failover.opt.TLSConfig == nil {
|
||||||
|
return netDialer.DialContext(ctx, network, addr)
|
||||||
|
}
|
||||||
|
return tls.DialWithDialer(netDialer, network, addr, failover.opt.TLSConfig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue