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

feat: Leading and trailing edge debounce for the file watch #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mike-Dax
Copy link
Contributor

@Mike-Dax Mike-Dax commented Oct 9, 2018

This PR removes the 100ms wait before starting compilation of changed files and instead introduces a leading+trailing edge debounce + an md5 hash.

The previous behavior was to wait until the 100ms after the last time the user saved a file, then it would compile.

Now it will immediately compile upon first save, and if the file is saved again it will debounce in a similar manner to previously. It will also hash the file and check if it has changed since the last compile. The debounce has been increased to 300ms.

feat: Hash the files and don't re-run the compilation if they're the same.


feat: Ignore initial file watch events.


feat: Different hash


feat: Removed timer
@PepsRyuu
Copy link
Owner

PepsRyuu commented Oct 9, 2018

Hmmm. Will need to test this one out a bit. There was a few situations I've been trying to address with the delay, and it was the quickest hack I could think of:

  • Sometimes when starting for the first time, hundreds of change events trigger, and it will rebuild hundreds of times and eventually start running.

  • Multiple events can trigger for the one file on a single save and might throw distinct events.

  • If multiple files are saved at the same time (for example, find and replace), could trigger multiple builds.

Might take a bit longer to get back to you on this one!

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.

2 participants