Fix for spurious rebuilds with watchdog>=2.3.0 #1117
Merged
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.
In release 2.3.0,
watchdog
enabled tracking of inotify IN_OPEN events. These fire whenever a file is opened (even when opened for reading). This can happen for any number of reasons, many of which are outside of our control. Currently, this can lead to frequent spurious rebuilds in some cases.The PR fixes things so as to ignore the new file-opened events from watchdog. Actually, here, we change strategy from ignoring events that we don't think we're interested in to specifically tracking only those types of events that we're interested in.
This PR also refactors our watchdog tests, to clean them up as well as to enable testing for the unwanted file-opened events.
(An alternative fix might be to adjust the
event_mask
passed to theInotify
observer constructor so as to exclude theIN_OPEN
bit. Doing so would reduce the number of events processed bywatchdog
, and so be more efficient — but it takes a lot of special-casing code on our part to apply the proper modifications to just theInotify
observer — and only in certain versions ofwatchdog
.)Issue(s) Resolved
Related Issues / Links
Also see PR #1118 which builds on this one, further refactoring and cleaning up the Watcher code (while changing the API in a backward-incompatible manner.)
Description of Changes