Skip to content

Commit

Permalink
Update context propagation for go 1.19
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Ilario <[email protected]>
  • Loading branch information
filariow committed Nov 7, 2023
1 parent dabc093 commit ae26f91
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/idler/idler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ func (r *Reconciler) ensureIdling(ctx context.Context, idler *toolchainv1alpha1.
}

// Check if it belongs to a controller (Deployment, DeploymentConfig, etc) and scale it down to zero.
lctx := context.WithoutCancel(ctx)
log.IntoContext(lctx, podLogger)
appType, appName, deletedByController, err := r.scaleControllerToZero(lctx, pod.ObjectMeta)
appType, appName, deletedByController, err := func() (string, string, bool, error) {
lctx, lcancel := context.WithCancel(ctx)
defer lcancel()
log.IntoContext(lctx, podLogger)
return r.scaleControllerToZero(lctx, pod.ObjectMeta)
}()
if err != nil {
return err
}
Expand Down

0 comments on commit ae26f91

Please sign in to comment.