mirror of
https://github.com/cloudreve/cloudreve.git
synced 2026-03-03 02:27:00 +00:00
fix(nodepool): exclusive lock should be held for weight LB
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user