howeyc/fsnotify

Polling fallback

nathany opened this issue · 3 comments

@pifantastic requested a polling fallback here #89 (comment)

GoConvery actually uses polling exclusively to avoid the "too many files" error (kqueue).

"we walk the file system every quarter second and use the sum of the last mod time stamp and size of each go file as a quick comparison. Along the way we make note of new and deleted packages, all the while skipping 'ignored' packages. It's actually quite speedy." - @mdwhatcott, Gopher Slack

https://github.com/smartystreets/goconvey/blob/master/web/server/watcher/scanner.go

I'm not sure if it should be part of fsnotify proper or not, but it should be easy to add one.

This is very nice! Thanks for pointing this out @nathany.

If you use an approach like what I've done in GoConvey, make sure to count empty directories as well...