Skip to content

Commit

Permalink
Avoid race in subsequent changes to the same controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mborsz committed Dec 19, 2022
1 parent 83e45df commit 19927c1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,10 @@ func (w *waitForControlledPodsRunningMeasurement) waitForRuntimeObject(obj runti
o := newObjectChecker(key)
o.lock.Lock()
defer o.lock.Unlock()
ctx, cancel := context.WithCancel(ctx)
o.cancel = cancel
w.handlingGroup.Start(func() {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
o.SetCancel(cancel)
if operationTimeout != time.Duration(0) {
ctx, cancel = context.WithTimeout(ctx, operationTimeout)
defer cancel()
Expand Down

0 comments on commit 19927c1

Please sign in to comment.