emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
4.96k stars 327 forks source link

Limiting number of time fswatch triggers event with fsevent monitor #225

Open sdondley opened 5 years ago

sdondley commented 5 years ago

I have a fswatch set up on a directory which triggers a script to refresh my browser every time a file is changed. I'm on a mac so I'm using FSEvent monitor. It works but if there is a bunch of files added or deleted in a single shot, the browser can refresh for many several minutes before it stops.

I've tried all the different switches but to no avail. I did find switching to poll_monitor works very well but I can't get it running faster than once every second. That's good enough but I'm still curious as to how I might get fswatch working well with FSEvent monitor.

Here is my current fswatch command:

fswatch -v -o . | xargs -n1 -I{} ~/bin/refresh.sh