Co-authored-by: zhoudeyu <zhoudeyu@xiaoheiban.cn>
master
Zcc、 4 years ago committed by GitHub
parent 8584351b6d
commit 4e0d91f6c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -140,7 +140,7 @@ func (h *ConsistentHash) Remove(node interface{}) {
index := sort.Search(len(h.keys), func(i int) bool { index := sort.Search(len(h.keys), func(i int) bool {
return h.keys[i] >= hash return h.keys[i] >= hash
}) })
if index < len(h.keys) { if index < len(h.keys) && h.keys[index] == hash {
h.keys = append(h.keys[:index], h.keys[index+1:]...) h.keys = append(h.keys[:index], h.keys[index+1:]...)
} }
h.removeRingNode(hash, nodeRepr) h.removeRingNode(hash, nodeRepr)

Loading…
Cancel
Save