Skip to content

Commit

Permalink
Don't lock across update()
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Robinson <hrobinson@slack-corp.com>
  • Loading branch information
henryr committed Jul 24, 2024
1 parent 81cffeb commit 301e0b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,16 @@ func (b *JSONGateResolverBuilder) start() error {
parseCount.Add("changed", 1)

b.mu.RLock()
resolvers := b.resolvers
b.mu.RUnlock()

// notify all the resolvers that the targets changed
for _, r := range b.resolvers {
for _, r := range resolvers {
err = b.update(r)
if err != nil {
log.Errorf("Failed to update resolver: %v", err)
}
}
b.mu.RUnlock()
}
}()

Expand Down

0 comments on commit 301e0b7

Please sign in to comment.