Originally reported by @kalepail in #313.
All community-submitted pull requests are automatically converted to issues (bugs) & discussions (feature requests, enhancements) where they can be triaged and prioritized. Once prioritized, a PR implementation is created automatically.
Describe the Bug
Running flue dev in a large repository or on a system with file watcher pressure causes the process to crash before the local dev server starts. The crash occurs because fs.watch(projectRoot) throws EMFILE: too many open files, watch (or ENOSPC) when the system's file watcher limit is exhausted, and the error is unhandled.
This is unnecessary because Flue already has the exact list of resolved config files it needs to watch and could poll them individually instead of watching the entire parent directory.
Expected Behavior
flue dev should start the local server even when the system cannot watch the config directory due to resource exhaustion (EMFILE/ENOSPC). Config file change detection should fall back to polling the resolved config files individually, and non-resource watcher errors should continue to fail fast.
Steps to Reproduce
- Open a large repository (or a system under file watcher pressure where the OS watcher limit is nearly exhausted)
- Run
flue dev
- Observe that the process exits with
EMFILE: too many open files, watch before the dev server starts
Original implementation from #313 by @kalepail
Describe the Bug
Running
flue devin a large repository or on a system with file watcher pressure causes the process to crash before the local dev server starts. The crash occurs becausefs.watch(projectRoot)throwsEMFILE: too many open files, watch(orENOSPC) when the system's file watcher limit is exhausted, and the error is unhandled.This is unnecessary because Flue already has the exact list of resolved config files it needs to watch and could poll them individually instead of watching the entire parent directory.
Expected Behavior
flue devshould start the local server even when the system cannot watch the config directory due to resource exhaustion (EMFILE/ENOSPC). Config file change detection should fall back to polling the resolved config files individually, and non-resource watcher errors should continue to fail fast.Steps to Reproduce
flue devEMFILE: too many open files, watchbefore the dev server startsOriginal implementation from #313 by @kalepail