Skip to content

Commit b532c55

Browse files
committed
sentinel: update
1 parent 0ee537f commit b532c55

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

pkg/utils/redis/sentinel.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,10 @@ func (s *Sentinel) Subscribe(sentinels []string, timeout time.Duration, onMajori
220220

221221
func (s *Sentinel) existsCommand(client *Client, names []string) (map[string]bool, error) {
222222
go func() {
223-
var pending int
224223
for _, name := range names {
225-
pending++
226224
client.conn.Send("SENTINEL", "get-master-addr-by-name", name)
227225
}
228-
if pending != 0 {
226+
if len(names) != 0 {
229227
client.conn.Flush()
230228
}
231229
}()
@@ -442,7 +440,6 @@ func (s *Sentinel) monitorGroupsCommand(client *Client, sentniel string, config
442440
}
443441
}
444442
go func() {
445-
var pending int
446443
for gid := range groups {
447444
var args = []interface{}{"set", s.NodeName(gid)}
448445
if config.ParallelSyncs != 0 {
@@ -463,13 +460,9 @@ func (s *Sentinel) monitorGroupsCommand(client *Client, sentniel string, config
463460
if config.ClientReconfigScript != "" {
464461
args = append(args, "client-reconfig-script", config.ClientReconfigScript)
465462
}
466-
if len(args) == 2 {
467-
continue
468-
}
469-
pending++
470463
client.conn.Send("SENTINEL", args...)
471464
}
472-
if pending != 0 {
465+
if len(groups) != 0 {
473466
client.conn.Flush()
474467
}
475468
}()

0 commit comments

Comments
 (0)