paulmillr / chokidar

Minimal and efficient cross-platform file watching library
https://paulmillr.com
MIT License
10.95k stars 580 forks source link

Throttling behavior may cause some events to be missed #1333

Closed valadaptive closed 3 months ago

valadaptive commented 3 months ago

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:

valadaptive commented 3 months ago

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?