Skip to content

Commit aa740ee

Browse files
authored
Add check to the master address has been obtained
Before closing the done channel, add a check to see if the master address has been obtained. If the master address has been obtained, then proceed with the subsequent operations.
1 parent a4aea25 commit aa740ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sentinel.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
618618
}
619619
return "", errors.New("redis: all sentinels specified in configuration are unreachable")
620620
case err := <-errCh:
621+
if masterAddr != "" {
622+
return masterAddr, nil
623+
}
621624
return "", err
622625
}
623626
}

0 commit comments

Comments
 (0)