Skip to content

Conversation

@JeremyTCD
Copy link
Member

@JeremyTCD JeremyTCD commented Mar 25, 2023

We use the framework FileSystemWatcher type to watch for file changes and restart Node.js when they occur. FileSystemWatcher is known to fire extra events on windows. To work around this, we were stopping FileSystemWatcher when we received an event:

and restarting it only after moving to a new Node.js process:

After 144, moving to a new process sped up to the point where we would sometimes:

  1. Receive a file changed event
  2. Stop the watcher
  3. Move to a new process
  4. Start the watcher
  5. Receive an extra of the initial file changed event
  6. Move to a new process again, unnecessarily

Unnecessary Node.js restarts caused tests to fail (e.g. first failure has 7 "file changed" logs when there should only be 5).

This PR fixes the issue by debouncing file changed events.

@JeremyTCD JeremyTCD force-pushed the fix_file_watcher_firing_extra_events branch from 75e6479 to face7ed Compare April 18, 2023 10:13
@JeremyTCD JeremyTCD merged commit 9e235ec into master Apr 18, 2023
@JeremyTCD JeremyTCD deleted the fix_file_watcher_firing_extra_events branch April 18, 2023 10:24
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.

1 participant