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

Commit 382f278

Browse files
authored
Use the CommitLoader for bundleAnalysisCompareWithParent (#1271)
1 parent 3b261ef commit 382f278

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

graphql_api/types/commit/commit.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,19 @@ def resolve_coverage_components(commit: Commit, info, filters=None) -> List[Comp
392392

393393

394394
@commit_bundle_analysis_bindable.field("bundleAnalysisCompareWithParent")
395-
@sync_to_async
396395
@sentry_sdk.trace
397-
def resolve_commit_bundle_analysis_compare_with_parent(
396+
async def resolve_commit_bundle_analysis_compare_with_parent(
398397
commit: Commit, info: GraphQLResolveInfo
399398
) -> Union[BundleAnalysisComparison, Any]:
400-
base_commit = Commit.objects.filter(commitid=commit.parent_commit_id).first()
401-
if not base_commit:
399+
if not commit.parent_commit_id:
402400
return MissingBaseCommit()
401+
base_commit = await CommitLoader.loader(info, commit.repository_id).load(
402+
commit.parent_commit_id
403+
)
403404

404-
bundle_analysis_comparison = load_bundle_analysis_comparison(base_commit, commit)
405+
bundle_analysis_comparison = await sync_to_async(load_bundle_analysis_comparison)(
406+
base_commit, commit
407+
)
405408

406409
# Store the created SQLite DB path in info.context
407410
# when the request is fully handled, have the file deleted

0 commit comments

Comments
 (0)