-
Notifications
You must be signed in to change notification settings - Fork 27
[BUG] File Watcher Confuses Poll Interval with Debounce Duration #199
Copy link
Copy link
Closed
Labels
Description
Project
vgrep
Description
The file watcher implementation in src/watcher.rs incorrectly uses the watch_debounce_ms configuration value as the poll_interval parameter for the notify watcher. These are conceptually different:
- Poll interval: How often to check the filesystem for changes (relevant for polling-based watchers)
- Debounce duration: How long to wait after receiving events before processing them (to batch rapid changes)
This means setting a high debounce value (e.g., 5000ms to batch rapid saves) actually slows down change detection to every 5 seconds, rather than batching events received within 5 seconds.
Error Message
Debug Logs
System Information
Bounty Version: 0.1.0
OS: Ubuntu 24.04 LTS
CPU: AMD EPYC-Genoa Processor (8 cores)
RAM: 15 GBScreenshots
No response
Steps to Reproduce
- Set a high debounce value:
vgrep config set watch-debounce 5000 - Start file watcher:
vgrep watch . - Create a new file:
echo "test" > test_file.rs - Observe that changes are detected every ~5 seconds, not debounced
Expected Behavior
- Debounce setting should control how long to wait before processing accumulated events
- File changes should be detected quickly (using OS-native events)
- Events within the debounce window should be batched together
Actual Behavior
- The debounce value is passed to
with_poll_interval() - File changes are only detected every N milliseconds (where N = debounce setting)
- No actual debouncing of events occurs
Additional Context
Location: src/watcher.rs:83
NotifyConfig::default().with_poll_interval(Duration::from_millis(self.debounce_ms)),Reactions are currently unavailable