I really wish JS had some sort of preemption for stuff like this. We have web workers now, but those work more like starting up another process since you can't pass functions to them.
was just reading the promise black hole and the use of generators to ensure process chain terminations is definitely a missing problem that workers don't solve.
unless you're referring to a brute force one-off shutdown.