1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Make sentinel tests more reliable.

This commit is contained in:
Vladimir Mihailenco
2015-01-30 16:45:57 +02:00
parent 15a90c831b
commit 7f87de6109
3 changed files with 22 additions and 9 deletions

View File

@ -170,6 +170,13 @@ type Options struct {
IdleTimeout time.Duration
}
func (opt *Options) getNetwork() string {
if opt.Network == "" {
return "tcp"
}
return opt.Network
}
func (opt *Options) getPoolSize() int {
if opt.PoolSize == 0 {
return 10
@ -207,7 +214,7 @@ func NewClient(clOpt *Options) *Client {
dialer := clOpt.Dialer
if dialer == nil {
dialer = func() (net.Conn, error) {
return net.DialTimeout(clOpt.Network, clOpt.Addr, opt.DialTimeout)
return net.DialTimeout(clOpt.getNetwork(), clOpt.Addr, opt.DialTimeout)
}
}
return &Client{