node-dev icon indicating copy to clipboard operation
node-dev copied to clipboard

Implement a global change debounce

Open dobesv opened this issue 1 year ago • 4 comments

This changes the debounce timeout to apply globally rather than per-file. This fixes an issue where if various different files were being changed, the process would restart even though the debounce time had not passed.

Fixes https://github.com/fgnass/node-dev/issues/301

dobesv avatar Sep 06 '23 04:09 dobesv

Thank you for the PR, could you add a test that ensures the behavior you're trying to fix stays fixed?

bjornstar avatar Sep 08 '23 01:09 bjornstar

could you add a test that ensures the behavior you're trying to fix stays fixed

I'm not opposed to this. Do you have an example of a test already in place I could work from? This seems a bit tricky to test.

dobesv avatar Sep 09 '23 00:09 dobesv

The tests in test/spawn attempt to run the code in test/fixtures. You could make a fixture that requires two different files then add a test referencing that fixture and make sure the restart only occurs one time.

bjornstar avatar Sep 09 '23 02:09 bjornstar

OK I think figured out a test. At least, if I revert the change the test fails, and with the change it passes.

There seem to be some delays in the change notifications that I don't quite understand. I was seeing an extra second or more delay added on top of the debounce here, so the delays in the test are pretty long to absorb that.

dobesv avatar Sep 09 '23 07:09 dobesv