Various fixes for updating dircounts with watch enabled (#1881)

* Fix file size bug when copying files

* Don't remove existing watches

* Bump fsnotify

* Ignore watching `/dev`
This commit is contained in:
Joe Lim authored and GitHub committed 2025-01-15 13:06:00 +11:00
1 parent 8bfa3a6d34
commit 2095efa661
5 files changed
+20 -22

No files matched your search

+5 -8
View File
@@ -64,19 +64,16 @@ func (watch *watch) stop() {
watch.events = nil
}
func (watch *watch) set(paths map[string]bool) {
func (watch *watch) add(paths map[string]bool) {
if watch.watcher == nil {
return
}
for _, path := range watch.watcher.WatchList() {
if !paths[path] {
watch.watcher.Remove(path)
}
}
for path := range paths {
watch.watcher.Add(path)
// ignore /dev since write updates to /dev/tty causes high cpu usage
if path != "/dev" {
watch.watcher.Add(path)
}
}
}