Skip to content

Commit bf7d111

Browse files
fix: wrap new TA impl in try except for cache rollups (#361)
1 parent 6c9fb21 commit bf7d111

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

apps/worker/tasks/cache_test_rollups.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Literal
33

44
import polars as pl
5+
import sentry_sdk
56
from django.db import connections
67
from redis.exceptions import LockError
78

@@ -125,10 +126,15 @@ def run_impl(
125126
f"rollups:{repo_id}:{branch}", timeout=300, blocking_timeout=2
126127
):
127128
if impl_type == "new" or impl_type == "both":
128-
cache_rollups(repo_id, branch)
129-
cache_rollups(repo_id, None)
130-
if impl_type == "new":
131-
return {"success": True}
129+
try:
130+
cache_rollups(repo_id, branch)
131+
cache_rollups(repo_id, None)
132+
if impl_type == "new":
133+
return {"success": True}
134+
except Exception as e:
135+
sentry_sdk.capture_exception(e)
136+
if impl_type == "new":
137+
return {"success": False}
132138

133139
self.run_impl_within_lock(repo_id, branch)
134140

apps/worker/tasks/process_flakes.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
from typing import Any, Literal, cast
33

4+
import sentry_sdk
45
from redis import Redis
56
from redis.exceptions import LockError
67
from sqlalchemy.orm import Session
@@ -69,9 +70,14 @@ def run_impl(
6970
log.info("Received process flakes task")
7071

7172
if impl_type == "new" or impl_type == "both":
72-
process_flakes_for_repo(repo_id)
73-
if impl_type == "new":
74-
return {"successful": True}
73+
try:
74+
process_flakes_for_repo(repo_id)
75+
if impl_type == "new":
76+
return {"successful": True}
77+
except Exception as e:
78+
sentry_sdk.capture_exception(e)
79+
if impl_type == "new":
80+
return {"successful": False}
7581

7682
redis_client = get_redis_connection()
7783
lock_name = LOCK_NAME.format(repo_id)

0 commit comments

Comments
 (0)