Skip to content

Commit

Permalink
Remove timeout from spawning process manager prepare workload (#306)
Browse files Browse the repository at this point in the history
Co-authored-by: kt <[email protected]>
  • Loading branch information
kthomas and kthomas authored Jul 2, 2024
1 parent 674ccbb commit 5b518c5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions internal/node/processmanager/spawn_procman.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,16 @@ func (s *SpawningProcessManager) EnterLameDuck() error {

// Attaches a deployment request to a running process. Until a process is prepared, it's just an empty agent
func (s *SpawningProcessManager) PrepareWorkload(workloadID string, deployRequest *agentapi.DeployRequest) error {
select {
case proc := <-s.warmProcs:
if proc == nil {
return fmt.Errorf("could not prepare workload, no agent process")
}
proc.deployRequest = deployRequest
proc.workloadStarted = time.Now().UTC()

s.deployRequests[proc.ID] = deployRequest
case <-time.After(500 * time.Millisecond):
return fmt.Errorf("timed out waiting for available agent process")
proc := <-s.warmProcs
if proc == nil {
return fmt.Errorf("could not prepare workload, no available agent process")
}

proc.deployRequest = deployRequest
proc.workloadStarted = time.Now().UTC()

s.deployRequests[proc.ID] = deployRequest

return nil
}

Expand Down

0 comments on commit 5b518c5

Please sign in to comment.