-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Process Chokidar events batches sequentially
We buffer events emitted by Chokidar as the underlying FSEvents API, on macOS, can add delay between events relating to the same document and processing the first events without the latter ones can lead to wrong asumptions about what changes were actually made. Buffered events are then flushed 10 seconds after the last event was buffered (i.e. each buffered event resets the 10 seconds delay). Since this process is asynchronous and is only time-based, we can end up flushing buffered events while some previous batch is still being processed, creating situations where unexpected behavior can happen. To prevent this, we now prevent any buffer flushes while a batch is being processed and restore the flushing timeout once finished. This can add a small delay to the next batch processing but since we don't know if already buffered events could be flushed at that point it seems safer.
- Loading branch information
1 parent
753ca3c
commit e0532e9
Showing
4 changed files
with
174 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.