From 013d76ce24ea1ed47c337219e91e8a1db663c72e Mon Sep 17 00:00:00 2001 From: GITSRC <34047788+gitsrc@users.noreply.github.com> Date: Mon, 14 Jan 2019 16:02:58 +0800 Subject: [PATCH] Update hashring.go --- hashring.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hashring.go b/hashring.go index 4ac0ffd..fb428cc 100644 --- a/hashring.go +++ b/hashring.go @@ -82,6 +82,8 @@ func (h *HashRing) UpdateNode(nodeKey string, weight int) { } func (h *HashRing) generate() { + h.mu.Lock() + defer h.mu.Unlock() var totalW int for _, w := range h.weights { totalW += w