Skip to content

Commit

Permalink
uses pool mutex to select random agent (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
autodidaddict authored Jun 28, 2024
1 parent 5b52b46 commit 375ee51
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/node/workload_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ func (w *WorkloadManager) createHostServicesConnection(request *agentapi.DeployR

// Picks a pending agent from the pool that will receive the next deployment
func (w *WorkloadManager) SelectRandomAgent() (*agentapi.AgentClient, error) {
w.poolMutex.Lock()
defer w.poolMutex.Unlock()

if len(w.pendingAgents) == 0 {
return nil, errors.New("no available agent client in pool")
}
Expand Down

0 comments on commit 375ee51

Please sign in to comment.