Merge pull request #1 from gitsrc/gitsrc-patch-1

Update hashring.go
This commit is contained in:
GITSRC 2019-01-14 16:03:10 +08:00 committed by GitHub
commit 2d0ad44404
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