Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93c01ea

Browse files
fixed GetNumberSentinelSlavesInMemory
1 parent af94a65 commit 93c01ea

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎pkg/client/redis/client.go‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,18 @@ func (c *client) GetNumberSentinelSlavesInMemory(ip string, auth *util.AuthConfi
104104
return 0, err
105105
}
106106
nSlaves := 0
107+
OUTER:
107108
for _, slaveInfoBlob := range slaveInfoBlobs {
108109
slaveInfo := reflect.ValueOf(slaveInfoBlob)
109-
slavePriority := fmt.Sprintf("%+v", slaveInfo.Index(37))
110-
if slavePriority == "1" {
111-
nSlaves += 1
110+
for key, value := range slaveInfoBlob.([]interface{}) {
111+
stringValue := value.(string)
112+
if stringValue == "slave-priority" {
113+
slavePriority := fmt.Sprintf("%+v", slaveInfo.Index(key+1))
114+
if slavePriority == "1" {
115+
nSlaves += 1
116+
}
117+
continue OUTER
118+
}
112119
}
113120
}
114121

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /