瀏覽代碼

fix (#592)

Co-authored-by: zhoudeyu <zhoudeyu@xiaoheiban.cn>
Zcc、 4 年之前
父節點
當前提交
4e0d91f6c0
共有 1 個文件被更改,包括 1 次插入1 次删除
  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)