Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.
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
23 changes: 15 additions & 8 deletions services/processing/flake_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@
def process_flake_for_repo_commit(
repo_id: int,
commit_id: str,
):
with django_transaction.atomic():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of indenting all of this code, how about moving the transaction to the caller (along with the trailing log and return statement)

process_flake_in_transaction(repo_id, commit_id)

log.info(
"Successfully processed flakes",
extra=dict(repoid=repo_id, commit=commit_id),
)

return {"successful": True}


def process_flake_in_transaction(
repo_id: int,
commit_id: str,
):
uploads = ReportSession.objects.filter(
report__report_type=CommitReport.ReportType.TEST_RESULTS.value,
Expand Down Expand Up @@ -90,14 +105,6 @@ def process_flake_for_repo_commit(

upload.state = "flake_processed"
upload.save()
django_transaction.commit()

log.info(
"Successfully processed flakes",
extra=dict(repoid=repo_id, commit=commit_id),
)

return {"successful": True}


def get_test_instances(
Expand Down
Loading