Fix closing nil sentinel

This commit is contained in:
Vladimir Mihailenco 2018-10-25 09:42:56 +03:00
parent fa76dd0e87
commit 171a6d13e9
1 changed files with 5 additions and 2 deletions

View File

@ -181,7 +181,10 @@ type sentinelFailover struct {
func (c *sentinelFailover) Close() error {
c.mu.Lock()
defer c.mu.Unlock()
if c.sentinel != nil {
return c.closeSentinel()
}
return nil
}
func (c *sentinelFailover) Pool() *pool.ConnPool {
@ -240,7 +243,7 @@ func (c *sentinelFailover) masterAddr() (string, error) {
if err != nil {
internal.Logf("sentinel: GetMasterAddrByName master=%q failed: %s",
c.masterName, err)
sentinel.Close()
_ = sentinel.Close()
continue
}