wybiral / tube

Personal video streaming server.
MIT License
264 stars 76 forks source link

Debounce watcher #6

Closed wybiral closed 5 years ago

wybiral commented 5 years ago

Currently the watcher is working overtime while a large file is being copied into the library because every flush during the copy triggers a write event in fsnotify which results in a bunch of unnecessary Library.Remove & Library.Add calls.

This can be fixed by debouncing the watcher so that events don't cause an action on a specific path until a fixed amount of time passes with no events. It may even be optimal to just accumulate all changes to the library and perform them in batch after a reasonable debounce time.