Documentation
¶
Index ¶
Constants ¶
const DefaultMaxWatches = 8192
DefaultMaxWatches bounds how many filesystem entries (directories + files) a single serve process registers with fsnotify. On macOS (kqueue) every watched entry costs one open file descriptor, so recursively watching a large workspace can push the process — and, multiplied across every concurrent serve (one per connected MCP client), the whole machine — into file-table exhaustion (ENFILE). Bounding the walk trades complete coverage of an oversized tree for a bound on fd usage: roughly the cap, plus the widest single watched directory (fsnotify opens an fd for every immediate entry the instant a directory is added, before the budget is re-checked, so one very wide directory can overrun the cap by its width). It is a soft ceiling, not a hard guarantee — a hard one would need patching fsnotify. A stale tail re-syncs on the next `docgraph sync` or restart. 0 disables the bound. See plans/serve-workspace-fd-exhaustion.
Variables ¶
This section is empty.
Functions ¶
func Watch ¶
func Watch(paths []string, onChange OnChangeFunc) error
func WatchWithContext ¶ added in v0.1.5
func WatchWithLimit ¶ added in v0.3.0
func WatchWithLimit(paths []string, maxWatches int, onChange OnChangeFunc) error
WatchWithLimit is Watch with an explicit per-process watch cap (see watchBudget / DefaultMaxWatches). 0 disables the cap.