Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Jan 23, 2025
1 parent 9fb48f7 commit 433d7ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions go/vt/vtctl/workflow/traffic_switcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,10 +1147,11 @@ func (ts *trafficSwitcher) cancelMigration(ctx context.Context, sm *StreamMigrat
}

// We create a new context while canceling the migration, so that we are independent of the original
// context being cancelled prior to or during the cancel operation.
// Create a child context that cannot be canceled by the parent, so that we maintain the locks.
// context being canceled prior to or during the cancel operation itself.
// First we create a copy of the parent context, so that we maintain the locks, but which cannot be
// canceled by the parent context.
cctx := context.WithoutCancel(ctx)
// Now create a child context from that which has a timeout.
// Now we create a child context from that which has a timeout.
cmTimeout := 60 * time.Second
cmCtx, cmCancel := context.WithTimeout(cctx, cmTimeout)
defer cmCancel()
Expand Down

0 comments on commit 433d7ff

Please sign in to comment.