Skip to content

[BUG] File Watcher Confuses Poll Interval with Debounce Duration #199

@EnthusiasticTech

Description

@EnthusiasticTech

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 GB

Screenshots

No response

Steps to Reproduce

  1. Set a high debounce value: vgrep config set watch-debounce 5000
  2. Start file watcher: vgrep watch .
  3. Create a new file: echo "test" > test_file.rs
  4. Observe that changes are detected every ~5 seconds, not debounced

Expected Behavior

  1. Debounce setting should control how long to wait before processing accumulated events
  2. File changes should be detected quickly (using OS-native events)
  3. Events within the debounce window should be batched together

Actual Behavior

  1. The debounce value is passed to with_poll_interval()
  2. File changes are only detected every N milliseconds (where N = debounce setting)
  3. No actual debouncing of events occurs

Additional Context

Location: src/watcher.rs:83

NotifyConfig::default().with_poll_interval(Duration::from_millis(self.debounce_ms)),

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvalidValid issuevgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions