Fix a cache invalidation issue with Distributions serving publications indirectly via repository_version - #8008
Open
dralley wants to merge 1 commit into
Open
Fix a cache invalidation issue with Distributions serving publications indirectly via repository_version#8008dralley wants to merge 1 commit into
dralley wants to merge 1 commit into
Conversation
dralley
force-pushed
the
cache-invalidation-bug
branch
from
August 25, 2026 03:47
fbcdd0c to
d817c09
Compare
dralley
commented
Aug 25, 2026
dralley
force-pushed
the
cache-invalidation-bug
branch
2 times, most recently
from
August 25, 2026 05:00
023e815 to
33db05a
Compare
Contributor
Author
|
Not quite ready for review yet. |
dralley
force-pushed
the
cache-invalidation-bug
branch
3 times, most recently
from
August 31, 2026 03:36
2b2fe3f to
a4a3d27
Compare
dralley
commented
Aug 31, 2026
| return | ||
| DistributedPublication(distribution=self, publication=pub).save() | ||
| # Check if this publication is already the active one | ||
| already_current = DistributedPublication.objects.filter( |
Contributor
Author
There was a problem hiding this comment.
Should this whole block be in a transaction?
dralley
force-pushed
the
cache-invalidation-bug
branch
from
August 31, 2026 18:24
a4a3d27 to
ca7d995
Compare
dralley
force-pushed
the
cache-invalidation-bug
branch
3 times, most recently
from
September 1, 2026 17:43
0f77dea to
9837ef2
Compare
dralley
force-pushed
the
cache-invalidation-bug
branch
from
September 1, 2026 17:59
9837ef2 to
9b956cc
Compare
…ions Distributions serving via `repository_version` were missed by cache invalidation and DistributedPublication tracking when publications were created or deleted. Also fixes DistributedPublication to reactivate (clear `expires_at`) when switching back to a recently-superseded publication, instead of creating a duplicate record. closes pulp#7993 Assisted-By: Claude Opus 4.6
dralley
force-pushed
the
cache-invalidation-bug
branch
from
September 1, 2026 18:07
9b956cc to
5391c08
Compare
dralley
marked this pull request as ready for review
September 1, 2026 18:07
gerrod3
reviewed
Sep 1, 2026
gerrod3
left a comment
Contributor
There was a problem hiding this comment.
The new cache invalidation scenario looks correct. I don't know enough about DistributedPublications to comment on the code changes there.
Comment on lines
+423
to
+424
| @pytest.mark.django_db | ||
| class TestCacheInvalidationOnDistributionUpdate: |
Contributor
There was a problem hiding this comment.
Do the cache invalidation tests belong here? Should they be in their own file?
Contributor
Author
There was a problem hiding this comment.
It would be reasonable to separate them but they're also somewhat coupled in the sense that a significant amount of logic is basically shared between the two and the scenarios are basically the same. If you feel strongly we can do that.
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.
Make sure we flush the cache (and update DistributedPublication) for
publications which were indirectly served via
Distribution.repository_version, rather than directly.
closes #7993