watcher

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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 WatchWithContext(ctx context.Context, paths []string, debounce time.Duration, maxWatches int, onChange OnChangeFunc) error

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.

Types

type OnChangeFunc

type OnChangeFunc func(projectPath string, changedFiles []string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL