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

This commit is contained in:
Aaron Liu
2026-01-14 12:41:26 +08:00
parent e8f965e980
commit 722abb81c5

View File

@@ -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 {