Browse Source

fix (#592)

Co-authored-by: zhoudeyu <zhoudeyu@xiaoheiban.cn>
Zcc、 4 years ago
parent
commit
4e0d91f6c0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/hash/consistenthash.go

+ 1 - 1
core/hash/consistenthash.go

@@ -140,7 +140,7 @@ func (h *ConsistentHash) Remove(node interface{}) {
 		index := sort.Search(len(h.keys), func(i int) bool {
 			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.removeRingNode(hash, nodeRepr)