Fix watch-folder startup race on Python 3.13#21
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4bda8e6a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| evt = self.running[watch_id] | ||
|
|
||
| prev = self._build_snapshot(config) | ||
| prev = dict(initial_snapshot or self._build_snapshot(config)) |
There was a problem hiding this comment.
Preserve empty initial snapshot when starting scanner
When the watched folder is empty at startup, initial_snapshot is {} (falsy), so initial_snapshot or self._build_snapshot(config) performs a second snapshot in the scanner thread. Any file created between start_watch() taking the first snapshot and this second snapshot is treated as already present in prev, so no created event is emitted for it. This reintroduces the startup race for the common empty-directory case the change is trying to fix.
Useful? React with 👍 / 👎.
Summary
Testing
Refs REC-178