mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
fix: crash in notificationsys when peers online is 0 (#11307)
Check if the number of peers online > 0 before using peerClient
This commit is contained in:
parent
d1a8f0b786
commit
845e251fa9
@ -1276,6 +1276,9 @@ func (sys *NotificationSys) restClientFromHash(s string) (client *peerRESTClient
|
||||
return nil
|
||||
}
|
||||
peerClients := sys.getOnlinePeers()
|
||||
if len(peerClients) == 0 {
|
||||
return nil
|
||||
}
|
||||
idx := xxhash.Sum64String(s) % uint64(len(peerClients))
|
||||
return peerClients[idx]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user