radovskyb / watcher

watcher is a Go package for watching for files or directory changes without using filesystem events.
BSD 3-Clause "New" or "Revised" License
1.48k stars 183 forks source link

SetMaxEvents limits the event creation for files #105

Open aditi-plivo opened 4 years ago

aditi-plivo commented 4 years ago

@radovskyb As a solution for High CPU usage for polling large directories to monitor Create/Move events watch.FilterOps(watcher.Create, watcher.Move)

We tried the following things:

But SetMaxEvents is not working as expected, as the files which are left after 5000 files are left as it is, once more files are created the watcher will again pickup random 5000 files to create events and the left over files are never picked up for event creation.

Would like to know if we misunderstood the use case for SetMaxEvents or using it in a wrong way

rizwankh commented 2 years ago

Facing the same issue. Even when I set the polling to 1 ms, it still misses some files, even though I have not set any SetMaxEvents at all.