fix(watcher.node): Normalize paths and improve Node watcher robustness: restart/rescan on errors (including ENOSPC), clear stale state, and remove legacy throttler
This commit is contained in:
@@ -80,11 +80,20 @@ The Node.js watcher has been refactored with elegant patterns inspired by [choki
|
||||
- Encapsulates file tracking and inode management
|
||||
- `dispose()` method freezes object to catch use-after-cleanup bugs
|
||||
|
||||
**Throttler Pattern:**
|
||||
- More sophisticated than simple debounce
|
||||
- Tracks count of suppressed events
|
||||
- Returns `false` if already throttled, `Throttler` object otherwise
|
||||
- Used for change events to prevent duplicate emissions
|
||||
**Path Normalization (v6.3.1+):**
|
||||
- ALL paths are normalized to absolute at entry points
|
||||
- Prevents relative/absolute path mismatch bugs
|
||||
- `watchPath()`, `handleFsEvent()`, `scanDirectory()` all resolve paths
|
||||
|
||||
**Restart Rescan (v6.3.1+):**
|
||||
- When watcher restarts, it rescans the directory
|
||||
- Catches files created during the restart window
|
||||
- Clears stale DirEntry data before rescan
|
||||
- Clears pending unlink timeouts to prevent stale events
|
||||
|
||||
**ENOSPC Handling (v6.3.1+):**
|
||||
- inotify limit errors now trigger watcher restart
|
||||
- Previously only logged error without recovery
|
||||
|
||||
**Atomic Write Handling:**
|
||||
- Unlink events are queued with 100ms delay
|
||||
|
||||
Reference in New Issue
Block a user