Skip to content

Commit 7a44633

Browse files
authored
Celery: handle known exceptions on delete_closed_external_versions (#10532)
Avoid logging known exceptions on Sentry when it's due to a user issue.
1 parent 803db6b commit 7a44633

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

readthedocs/builds/tasks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.urls import reverse
88
from django.utils import timezone
99
from django.utils.translation import gettext_lazy as _
10+
from oauthlib.oauth2.rfc6749.errors import InvalidGrantError, TokenExpiredError
1011

1112
from readthedocs import __version__
1213
from readthedocs.api.v2.serializers import BuildCommandSerializer
@@ -265,6 +266,8 @@ def delete_closed_external_versions(limit=200, days=30 * 3):
265266
commit=last_build.commit,
266267
status=status,
267268
)
269+
except (TokenExpiredError, InvalidGrantError):
270+
log.info("Failed to send status due to expired/invalid token.")
268271
except Exception:
269272
log.exception(
270273
"Failed to send status",

0 commit comments

Comments
 (0)