mirror of
https://github.com/docker/compose.git
synced 2026-11-18 14:13:49 +00:00
fix(up): preserve the actionable dependency-timeout message without --wait
Copilot review finding (low) on #14290: with --wait-timeout supplied but not --wait, a dependency timeout in upDetached returned the raw "context deadline exceeded" instead of the actionable "timeout waiting for dependencies" the legacy start()+waitDependencies path already reports for the exact same failure. The --wait-specific "application not healthy after %s" translation only ever covered the Wait=true case, leaving the Wait=false, WaitTimeout>0 case (a legal CLI combination -- --wait-timeout alone is a hang guard) with no translation at all. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
ebe25e3232
commit
bd088decbb
1 changed files with 11 additions and 2 deletions
|
|
@ -111,8 +111,17 @@ func (s *composeService) upDetached(ctx context.Context, project *types.Project,
|
|||
// independent deadline expire during exec.run -- that DeadlineExceeded
|
||||
// didn't come from any OpWaitCondition node's own derived timeout
|
||||
// either, so it isn't a health-readiness failure.
|
||||
if options.Start.Wait && options.Start.WaitTimeout > 0 && ctx.Err() == nil && errors.Is(err, context.DeadlineExceeded) {
|
||||
return fmt.Errorf("application not healthy after %s", options.Start.WaitTimeout)
|
||||
if options.Start.WaitTimeout > 0 && ctx.Err() == nil && errors.Is(err, context.DeadlineExceeded) {
|
||||
if options.Start.Wait {
|
||||
return fmt.Errorf("application not healthy after %s", options.Start.WaitTimeout)
|
||||
}
|
||||
// No --wait: this is exactly the dependency-timeout failure
|
||||
// start()'s own waitDependencies already reports as "timeout
|
||||
// waiting for dependencies" (service_containers.go) -- matching
|
||||
// that established, actionable message instead of leaking the
|
||||
// raw "context deadline exceeded" a user never configured in
|
||||
// those terms.
|
||||
return errors.New("timeout waiting for dependencies")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue