mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
On Linux fs.watch isn't recursive, so each working tree manually walks the entire subtree and registers a per-directory watcher. Every inotify event then re-scans the tree and rebuilds watchers. A working tree containing a directory that's continuously written (e.g. test-runtime data, build artefacts) drives the event loop to 100% CPU and the daemon stops responding on its websocket. Skip git-ignored directories when walking — load `git ls-files -o -i --directory --exclude-standard` once per root (5 min cache) and skip its entries. Cap the walked directory count at 5000 so a misconfigured repo can't blow past the inotify budget. Add a 2s cooldown between refresh passes so a flurry of events collapses into one re-scan instead of a tight loop. Co-authored-by: xuzhe.7766 <xuzhe.7766@bytedance.com>