Conversation
Without it if multiple changes occured at once, it will try to start process multiple times.
|
@bjornstar are you going to review this somehow? |
|
@bjornstar see please) |
|
I see test failures, and no tests to validate the behavior. |
|
Well, I've tried to reproduce the problem with tests, and could not: I'm pretty sure that in my case I see that multiple file changes happened at once resulted in multiple Btw if to add: watcher.on('change', file => {
if (isPaused) return;
isPaused = true;I don't see any current tests failing. |
|
@bjornstar So it seems that this case is is not easy to reproduce in tests. But logically it should be understood that this: watcher.on('change', file => {
if (isPaused) return;
isPaused = true;allows to prevent consequent changes that should not be handled. What do you think? |
|
hi @bjornstar, i use this PR as a patch and test:
and works fine 🔥 prevents a lot of unnecessary restarts. @wclr good work |
|
@bjornstar Look at this again please, this is a simple logical change that we will NOT handle any changes as soon as Current: With change: watcher.on('change', file => {
if (isPaused) return;
isPaused = true;
clearOutput();
notify('Restarting', `${file} has been modified`);
watcher.removeAll();
if (child) {
// Child is still running, restart upon exit
child.on('exit', start); |
Without it if multiple changes occured at once, it will try to start process multiple times.