Skip to content

Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest. - #2066

Open
jglogan wants to merge 1 commit into
apple:mainfrom
jglogan:directorywatcher-flake
Open

Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest.#2066
jglogan wants to merge 1 commit into
apple:mainfrom
jglogan:directorywatcher-flake

Conversation

@jglogan

@jglogan jglogan commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Fixes [Bug]: Localhost DNS /etc/resolvers directory watcher has racy startup, results in test flakes. #2065.
  • startWatching() returns before the watcher is ready to receive events, resulting in dropped events. Add readyEvents, an AsyncStream that yields once the watcher is actually active, so callers can await real readiness instead of guessing a sleep duration.
  • Prevent concurrent callers to startWatching(), as it does not support this mode of operation.
  • This fixes DirectoryWatcherTest's intermittent flakes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Principally to address test flakes, but it does address startup races.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

- Fixes apple#2065.
- `startWatching()` returns before the watcher is ready
  to receive events, resulting in dropped events. Add
  readyEvents, an AsyncStream that yields once the
  watcher is actually active, so callers can await
  real readiness instead of guessing a sleep duration.
- Prevent concurrent callers to startWatching(), as it
  does not support this mode of operation.
- This fixes DirectoryWatcherTest's intermittent flakes.
@jglogan
jglogan requested a review from JaewonHur August 4, 2026 01:47
@jglogan jglogan changed the title Add readiness signal to DirectoryWatcher, fix flaky DirectoryWatcherT… Add readiness signal to DirectoryWatcher, fix DirectoryWatcherTest. Aug 4, 2026
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.

[Bug]: Localhost DNS /etc/resolvers directory watcher has racy startup, results in test flakes.

1 participant