broccolijs / broccoli

Browser compilation library – an asset pipeline for applications that run in the browser
https://broccoli.build
MIT License
3.33k stars 217 forks source link

stop current build, when rebuild is triggered. #407

Closed gabrielcsapo closed 4 years ago

gabrielcsapo commented 5 years ago

When a funnel is being built, if a command to build again has been issued again, the funnel should stop its build and rebuild.

thoov commented 5 years ago

@gabrielcsapo Could you create a small repo with steps to reproduce?

thoov commented 5 years ago

Closing this issue as there hasn't been any movement on it for the last week. Feel free to reopen if you are able to create the reproduction steps.

rwjblue commented 5 years ago

FWIW, this is a legit feature request and something that @stefanpenner and I have discussed and planned on doing for quite a while (roughly since he implemented the cancelation code for Broccoli 2.0).

rwjblue commented 5 years ago

Steps to repro:

1) Have a large build pipeline that takes a few seconds 2) change a file (kicks off a rebuild) 3) change another file during that rebuild

Expected result:

Actual result:

stefanpenner commented 5 years ago

Broccoli should stop calling any node's .build method immediately after step 3 (essentially short circuiting the build) and start over

More specifically, it should continue the current build, and skip the next.

The code for this is actually largely implemented, but I believe requires the watcher be connected to the builder, to close the loop. Now that @oligriffiths and @thoov work landed, that should be quite easy to do.

cc @thoov maybe we can quickly look at that later today/tomorrow.

gabrielcsapo commented 5 years ago

I have a working PR here https://github.com/broccolijs/broccoli/pull/408 that should do exactly what was talked about in this thread. Thanks for explaining @rwjblue and @stefanpenner

oligriffiths commented 5 years ago

@gabrielcsapo thanks for the PR. I don’t think that gets us far enough. The Builder cancellation functionality needs updating first. Will work on a fix for this.