feat(watcher.node): Add automatic restart, periodic health checks, and safe event emission to Node watcher; improve logging and stat handling

This commit is contained in:
2025-12-08 17:48:50 +00:00
parent 1c77a94b96
commit 2ce056f401
4 changed files with 204 additions and 21 deletions

View File

@@ -1,5 +1,17 @@
# Changelog
## 2025-12-08 - 6.1.0 - feat(watcher.node)
Add automatic restart, periodic health checks, and safe event emission to Node watcher; improve logging and stat handling
- NodeWatcher: introduced safeEmit() to isolate subscriber errors and prevent watcher crashes
- Auto-restart on failure with exponential backoff (1s → 30s) and up to 3 retry attempts per watched base path
- Periodic health checks (every 30s) to detect missing watched paths and trigger automatic restarts
- Handle unexpected FSWatcher 'close' events and restart watchers when they close silently
- Verbose lifecycle logging with `[smartwatch]` prefix for start/stop/health/restart events
- Clear restart tracking and stop health checks on watcher.stop() to ensure clean shutdown
- Improved statSafe() to normalize followSymlinks logic and log non-ENO errors as warnings
- Updated readme.hints.md documenting the new robustness features (v6.1.0+)
## 2025-12-08 - 6.0.0 - BREAKING CHANGE(watchers)
Replace polling-based write stabilization with debounce-based event coalescing and simplify watcher options