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

Commit e808b5b

Browse files
committed
fix ta_finish_upload
1 parent e1c852e commit e808b5b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

services/test_analytics/ta_finish_upload.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
log = logging.getLogger(__name__)
4545

4646

47-
def get_upload_ids(commitid: str) -> dict[int, ReportSession]:
47+
def get_relevant_upload_ids(commitid: str) -> dict[int, ReportSession]:
4848
return {
4949
upload.id: upload
5050
for upload in ReportSession.objects.filter(
@@ -55,7 +55,11 @@ def get_upload_ids(commitid: str) -> dict[int, ReportSession]:
5555

5656

5757
def get_upload_error(upload_ids: list[int]) -> ErrorPayload | None:
58-
error = UploadError.objects.filter(report_session_id__in=upload_ids).first()
58+
error = (
59+
UploadError.objects.filter(report_session_id__in=upload_ids)
60+
.order_by("created_at")
61+
.first()
62+
)
5963
if error:
6064
return ErrorPayload(
6165
error_code=error.error_code,
@@ -151,7 +155,7 @@ def new_impl(
151155
"queue_notify": False,
152156
}
153157

154-
upload_ids = get_upload_ids(commitid)
158+
upload_ids = get_relevant_upload_ids(commitid)
155159
error = get_upload_error(list(upload_ids.keys()))
156160

157161
with read_tests_totals_summary.labels(impl="new").time():

0 commit comments

Comments
 (0)