Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit c22197c

Browse files
authored
Log errors starting Repository cleanup (#1215)
1 parent 1d83bf1 commit c22197c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

services/cleanup/repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
from uuid import uuid4
33

4+
import sentry_sdk
45
from django.db import DatabaseError, IntegrityError, transaction
56
from shared.django_apps.codecov_auth.models import Owner
67
from shared.django_apps.core.models import Repository
@@ -17,10 +18,11 @@ def cleanup_repo(repo_id: int) -> CleanupSummary:
1718
except Repository.DoesNotExist:
1819
log.warning("Repository does not exist / was already cleaned up")
1920
return CleanupSummary(CleanupResult(0), {})
20-
except (DatabaseError, IntegrityError) as _:
21+
except (DatabaseError, IntegrityError) as e:
2122
# `DatabaseError` means that the `SELECT FOR UPDATE NOWAIT` is currently locked.
2223
# `IntegrityError` means that the `Owner.create` has a duplicated `service_id`.
23-
log.warning("Cleanup could not be started because of conflicting job")
24+
sentry_sdk.capture_exception(e)
25+
log.exception("Cleanup could not be started because of conflicting job")
2426
return CleanupSummary(CleanupResult(0), {})
2527

2628
if cleanup_started:

0 commit comments

Comments
 (0)