Repository navigation
fix(pickle): match cache-file events by name so waiters wake under watchdog 7 - #408
Open
marziomont wants to merge 2 commits into
Open
marziomont wants to merge 2 commits into
marziomont wants to merge 2 commits into
Conversation
…tchdog 7 watchdog 7 matches PatternMatchingEventHandler patterns against the whole path (PurePath.full_match), so the "*" + filename pattern never matched an absolute event path. A caller waiting on an entry being calculated by another thread or process never saw the change and hung forever.
for more information, see https://pre-commit.ci
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
watchdog 7.0.0 changed
PatternMatchingEventHandlerto match patterns withPurePath.full_match()instead ofPurePath.match().full_matchmatches against the whole path, so the pickle core's"*" + filenamepattern no longer matches an absolute event path such as/cache/dir/.module.func:A caller that finds an entry being calculated by another thread or process waits for the cache file to change. Under watchdog 7 the handler never fires, and with no
wait_for_calc_timeoutthe waiter hangs forever.cachier requires
watchdog>=2.3.1with no upper bound, so a fresh install picks up 7.x.uv.lockpins watchdog 6.0.0, which is why CI hasn't caught it.Fix
CacheChangeHandlernow subclassesFileSystemEventHandlerand dispatches only the events whose source or destination file name equals the cache file's name. It ignores directory events. This matches by name instead of by glob, so it behaves the same under every watchdog version.Tests
A new parametrized test checks the handler against full-path events: modified, created, a move onto the file, a sibling
.lockfile, another function's cache file, and a directory event.Pickle core tests on Linux (Python 3.13, in Docker):