Skip to content

Conversation

zorro786
Copy link

Failing which Balance() will not work as expected

c.Lock()
defer c.Unlock()

atomic.AddInt64(&c.totalLoad, -c.loadMap[host].Load)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you must check if host exists in loadMap before attempting to do anything..

h, ok := c.loadMap[host]
if !ok {
  return true
}
atomic.AddInt64(&c.totalLoad, -h.Load)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants