From 4e0d91f6c00f41b48442005f017b35bad746eda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zcc=E3=80=81?= <1104503035@qq.com> Date: Thu, 1 Apr 2021 18:42:50 +0800 Subject: [PATCH] fix (#592) Co-authored-by: zhoudeyu --- core/hash/consistenthash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hash/consistenthash.go b/core/hash/consistenthash.go index b719a672..911b46c1 100644 --- a/core/hash/consistenthash.go +++ b/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)