Skip to content

Commit

Permalink
util/stop: finish task span before Stop() returns
Browse files Browse the repository at this point in the history
Before this patch, a task's span was finished after the stopper
considered the task to be finished. This was a problem for a test who
wanted to assume that, once stopper.Stop() returns, all task spans are
finished - which is a reasonable contract to expect. This patch reorders
the span finish accordingly.

Fixes #83886

Release note: None
Epic: None
  • Loading branch information
andreimatei committed Nov 22, 2022
1 parent 02b3a94 commit efb93cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/util/stop/stopper.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ func (s *Stopper) RunAsyncTaskEx(ctx context.Context, opt TaskOpts, f func(conte
// Call f on another goroutine.
taskStarted = true // Another goroutine now takes ownership of the alloc, if any.
go func() {
defer sp.Finish()
defer s.runPostlude()
defer sp.Finish()
defer s.recover(ctx)
if alloc != nil {
defer alloc.Release()
Expand Down

0 comments on commit efb93cb

Please sign in to comment.