Skip to content

Commit

Permalink
revert ctx to ctx.Bg
Browse files Browse the repository at this point in the history
Signed-off-by: schristoff <28318173+schristoff@users.noreply.github.com>
  • Loading branch information
schristoff committed Jul 31, 2024
1 parent f32d9aa commit 69e76b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pkg/packager/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ func runAction(ctx context.Context, defaultCfg types.ZarfComponentActionDefaults
duration := time.Duration(actionDefaults.MaxTotalSeconds) * time.Second
timeout := time.After(duration)

ctx, cancel := context.WithTimeout(ctx, duration)
defer cancel()

// Keep trying until the max retries is reached.
retryCmd:
for remaining := actionDefaults.MaxRetries + 1; remaining > 0; remaining-- {
Expand Down Expand Up @@ -131,7 +128,8 @@ retryCmd:
// If no timeout is set, run the command and return or continue retrying.
if actionDefaults.MaxTotalSeconds < 1 {
spinner.Updatef("Waiting for \"%s\" (no timeout)", cmdEscaped)
if err := tryCmd(ctx); err != nil {
//TODO (schristoff): Make it so tryCmd can take a normal ctx
if err := tryCmd(context.Background()); err != nil {
continue retryCmd
}

Expand All @@ -147,7 +145,8 @@ retryCmd:

// Otherwise, try running the command.
default:

ctx, cancel := context.WithTimeout(ctx, duration)
defer cancel()
if err := tryCmd(ctx); err != nil {
continue retryCmd
}
Expand Down

0 comments on commit 69e76b2

Please sign in to comment.