fix(nodepool): exclusive lock should be held for weight LB

master
Aaron Liu 6 days ago
parent e8f965e980
commit 722abb81c5

@ -87,8 +87,8 @@ func NewNodePool(ctx context.Context, l logging.Logger, config conf.ConfigProvid
func (p *weightedNodePool) Get(ctx context.Context, capability types.NodeCapability, preferred int) (Node, error) {
l := logging.FromContext(ctx)
p.lock.RLock()
defer p.lock.RUnlock()
p.lock.Lock()
defer p.lock.Unlock()
nodes, ok := p.nodes[capability]
if !ok || len(nodes) == 0 {

Loading…
Cancel
Save