Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache: purge rtd-addons when a new version is enabled & built #11489

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion readthedocs/projects/tasks/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,18 @@ def get_valid_artifact_types(self):
def on_success(self, retval, task_id, args, kwargs):
valid_artifacts = self.get_valid_artifact_types()

# NOTE: we are updating the db version instance *only* when
# NOTE: we are updating the db version instance *only* if HTML build was successful
# TODO: remove this condition and *always* update the DB Version instance
if "html" in valid_artifacts:
if settings.READ_THE_DOCS_EXTENSIONS:
from readthedocsext.cdn.tasks import purge_tags

if not self.data.version.built:
# When the version was previously NOT built and now this build was successful,
# we purge the Addons API cache at this point.
# There is a new version that has to be shown in the flyout.
purge_tags.delay(["rtd-addons"])

try:
self.data.api_client.version(self.data.version.pk).patch(
{
Expand Down