Skip to content

fix(watcher): prevent dropped events under high churn + make buffer s… - #100

Merged
truthixify merged 1 commit into
wraith-protocol:developfrom
iwayemi5:develop
Jul 27, 2026
Merged

fix(watcher): prevent dropped events under high churn + make buffer s…#100
truthixify merged 1 commit into
wraith-protocol:developfrom
iwayemi5:develop

Conversation

@iwayemi5

Copy link
Copy Markdown
Contributor

Summary

The file watcher could silently drop events when the kernel event queue overflowed (common on busy directories or certain filesystems). This change:

  • Switches to a larger, configurable in-memory event buffer
  • Adds back-pressure / coalescing so we never lose create/modify/delete events
  • Exposes the buffer size via CLI flag and config file
  • Adds unit tests that simulate event storms

Changes

  • src/watcher.rs: rewrite of the event loop using a bounded channel + coalescing map
  • New --event-buffer-size flag (default 8192)
  • Config support in syncer.toml
  • Tests in tests/watcher_stress.rs that hammer the watcher with concurrent create/rename/delete

Test plan

  • Unit tests pass (cargo test)
  • Manual stress test on macOS (APFS) and Linux (ext4) with thousands of rapid file changes
  • Verified no events are lost when buffer is sized appropriately
  • Backward-compatible: existing configs continue to work with the new default

Closes #94

@truthixify
truthixify merged commit 154f05a into wraith-protocol:develop Jul 27, 2026
2 checks passed
@truthixify

Copy link
Copy Markdown
Contributor

In. Under-load event drops were subtle, glad you caught the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs snippet-check hardening (AST-based)

2 participants