Skip to content

Commit

Permalink
Detach the context in case of an interrupt (#3536)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed May 9, 2024
1 parent 3cb555f commit 976f74a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/command/deploy/machines_deploymachinesapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func (md *machineDeployment) DeployMachinesApp(ctx context.Context) error {

ctx = flaps.NewContext(ctx, md.flapsClient)

onInterruptContext := context.WithoutCancel(ctx)

if err := md.updateReleaseInBackend(ctx, "running"); err != nil {
tracing.RecordError(span, err, "failed to update release")
return fmt.Errorf("failed to set release status to 'running': %w", err)
Expand All @@ -65,7 +67,7 @@ func (md *machineDeployment) DeployMachinesApp(ctx context.Context) error {
// Provide an extra second to try to update the release status.
status = "interrupted"
var cancel func()
ctx, cancel = context.WithTimeout(ctx, time.Second)
ctx, cancel = context.WithTimeout(onInterruptContext, time.Second)
defer cancel()
default:
status = "failed"
Expand Down

0 comments on commit 976f74a

Please sign in to comment.