Uh oh!
There was an error while loading. Please reload this page.
Fix a cache invalidation issue with Distributions serving publications indirectly via repository_version - #8008
Draft
dralley wants to merge 3 commits into
Draft
Fix a cache invalidation issue with Distributions serving publications indirectly via repository_version#8008dralley wants to merge 3 commits into
dralley wants to merge 3 commits into
Conversation
dralleyforce-pushed
the
cache-invalidation-bug
branch
from
August 25, 2026 03:47
fbcdd0c to
d817c09Comparedralley
commented
Aug 25, 2026
Uh oh!
There was an error while loading. Please reload this page.
dralleyforce-pushed
the
cache-invalidation-bug
branch
2 times, most recently
from
August 25, 2026 05:00
023e815 to
33db05aComparedralley
commented
Aug 25, 2026
ContributorAuthor
Not quite ready for review yet. |
dralleyforce-pushed
the
cache-invalidation-bug
branch
3 times, most recently
from
August 31, 2026 03:36
2b2fe3f to
a4a3d27Comparedralley
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( |
ContributorAuthor
There was a problem hiding this comment.
Should this whole block be in a transaction?
…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. closespulp#7993 Assisted-By: Claude Opus 4.6
Adds an unlocked EXISTS query before entering the transaction to handle the common case where the publication is already active. Reduces lock contention and database load when distributions are updated frequently. Also replaces list() with first() in the locked path since at most one DistributedPublication exists per (distribution, publication) pair.
dralleyforce-pushed
the
cache-invalidation-bug
branch
from
August 31, 2026 18:24
a4a3d27 to
ca7d995Comparedralleyforce-pushed
the
cache-invalidation-bug
branch
from
August 31, 2026 18:27
ca7d995 to
d8baa35Comparedralleyforce-pushed
the
cache-invalidation-bug
branch
from
September 1, 2026 00:22
d8baa35 to
0f77deaCompare
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 freeto 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