Skip to content

Commit

Permalink
fix: ptah-sh/ptah-server#239 wait longer for tasks to complete
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Oct 18, 2024
1 parent 31a2eed commit 699adf7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/app/ptah-agent/service_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,25 @@ func (e *taskExecutor) monitorDaemonServiceLaunch(ctx context.Context, service *
return nil
}

failedTasks := 0
var lastErr string
for _, t := range tasks {
if t.Status.Err != "" {
return errors.Errorf("task %s failed: %s", t.ID, t.Status.Err)
failedTasks++
lastErr = t.Status.Err
}
}

if failedTasks > 5 {
return errors.Errorf("task failed: %s", lastErr)
}

if failedTasks > 0 {
log.Debug("service has failed tasks", "failed_tasks", failedTasks, "last_error", lastErr)

continue
}

successfullChecks++

if successfullChecks >= 3 {
Expand Down

0 comments on commit 699adf7

Please sign in to comment.