Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a global change debounce #302

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

dobesv
Copy link

@dobesv dobesv commented Sep 6, 2023

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 #301

@bjornstar
Copy link
Collaborator

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

@dobesv
Copy link
Author

dobesv commented Sep 9, 2023

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.

@bjornstar
Copy link
Collaborator

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.

@dobesv
Copy link
Author

dobesv commented Sep 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debounce is per-file, not global
2 participants