-
Notifications
You must be signed in to change notification settings - Fork 78
Description
If you create a new directory, create a new file in it, then modify the file ... the new directory gets listed, there is a race, the list might already see the new file. That races with the new file event and modify event. New file event and modify event arriving together get combined into just "new file". "New file" is then discarded because the file has already been seen in the list and reported as a new file. The modify event that was combined with the new file event is just dropped, so the last modification is never notified, and the state seen is from before the modification.
So the fix should be something like: discard "add" events for already-notified files before merging "modify" events into "add" events.
The bizarre "time travel" effect was because an earlier notification from the list was replacing a later one from the modification, so the user of package:watcher does actually get notified earlier and see an earlier state.
Discovered while adding an e2e test.
There is currently a 100ms delay baked into the Windows directory watcher, I suspect it relates to this race and can be reduced/removed.