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.
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.