Versions (please complete the following information):
Chokidar version: v3 and current v4 beta
Node version: N/A
OS version: N/A
To Reproduce:
I don't currently have a test case for this.
Expected behavior
A change event should be fired every time some set of changes is made to a file. It need not be fired for every change that is made, but Chokidar should not miss any changes.
Currently, the throttling behavior drops any changes that occur within 5ms of an earlier change. This means that if a file changes, and another change occurs within 5ms, only the first change will ever be recorded. This could potentially be the cause of https://github.com/paulmillr/chokidar/issues/1297.
I believe there are a few solutions:
Throttle on the trailing edge, rather than the leading edge (that is, emit the event on the last change within the 5ms window, not the first). This would add a 5ms delay to all events.
Emit events on the leading and trailing edge. This would allow events to be processed with no delay, but would result in duplicate change events being fired on Windows.
Automatically switch between the above two behaviors depending on the platform.
Throttle on the trailing edge, but reduce the time window to 1-2ms. On my machine, Windows-fired duplicate change events occur within 1-2ms of each other, but I do have a pretty fast SSD. I'm not sure how the timing would be affected by hardware.
It looks like this is also implemented as awaitWriteFinish in the current version--might it be worth simply building this into the throttling behavior by default?
Versions (please complete the following information):
To Reproduce:
I don't currently have a test case for this.
Expected behavior
A
change
event should be fired every time some set of changes is made to a file. It need not be fired for every change that is made, but Chokidar should not miss any changes.Currently, the throttling behavior drops any changes that occur within 5ms of an earlier change. This means that if a file changes, and another change occurs within 5ms, only the first change will ever be recorded. This could potentially be the cause of https://github.com/paulmillr/chokidar/issues/1297.
I believe there are a few solutions: