Skip to content

Celery: handle known exceptions on delete_closed_external_versions #10532

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

Merged
merged 1 commit into from
Jul 12, 2023
Merged
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
3 changes: 3 additions & 0 deletions readthedocs/builds/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from oauthlib.oauth2.rfc6749.errors import InvalidGrantError, TokenExpiredError

from readthedocs import __version__
from readthedocs.api.v2.serializers import BuildCommandSerializer
Expand Down Expand Up @@ -265,6 +266,8 @@ def delete_closed_external_versions(limit=200, days=30 * 3):
commit=last_build.commit,
status=status,
)
except (TokenExpiredError, InvalidGrantError):
log.info("Failed to send status due to expired/invalid token.")
except Exception:
log.exception(
"Failed to send status",
Expand Down