Update hashring.go

This commit is contained in:
GITSRC 2019-01-14 16:02:58 +08:00 committed by GitHub
parent 5d542568fd
commit 013d76ce24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,6 +82,8 @@ func (h *HashRing) UpdateNode(nodeKey string, weight int) {
} }
func (h *HashRing) generate() { func (h *HashRing) generate() {
h.mu.Lock()
defer h.mu.Unlock()
var totalW int var totalW int
for _, w := range h.weights { for _, w := range h.weights {
totalW += w totalW += w