Skip to content

Commit

Permalink
semantic change: always run onStart callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jan 17, 2023
1 parent 8ffa1b7 commit a3d3369
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,11 +1110,10 @@ func ScanBundle(

applyOptionDefaults(&options)

if options.CancelFlag.DidCancel() {
return Bundle{options: options}
}

// Run "onStart" plugins in parallel
// Run "onStart" plugins in parallel. IMPORTANT: We always need to run all
// "onStart" callbacks even when the build is cancelled, because plugins may
// rely on invariants that are started in "onStart" and ended in "onEnd".
// This works because "onEnd" callbacks are always run as well.
timer.Begin("On-start callbacks")
onStartWaitGroup := sync.WaitGroup{}
for _, plugin := range options.Plugins {
Expand Down Expand Up @@ -1201,6 +1200,7 @@ func ScanBundle(
onStartWaitGroup.Wait()
timer.End("On-start callbacks")

// We can check the cancel flag now that all "onStart" callbacks are done
if options.CancelFlag.DidCancel() {
return Bundle{options: options}
}
Expand Down

0 comments on commit a3d3369

Please sign in to comment.