fix: public issue list endpoint n+1 (#2099)

This commit is contained in:
Nikhil 2023-09-06 16:04:12 +05:30 committed by GitHub
parent 4f0cac37db
commit 2ad46d7bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2100,6 +2100,12 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
queryset=IssueReaction.objects.select_related("actor"), queryset=IssueReaction.objects.select_related("actor"),
) )
) )
.prefetch_related(
Prefetch(
"votes",
queryset=IssueVote.objects.select_related("actor"),
)
)
.filter(**filters) .filter(**filters)
.annotate(cycle_id=F("issue_cycle__cycle_id")) .annotate(cycle_id=F("issue_cycle__cycle_id"))
.annotate(module_id=F("issue_module__module_id")) .annotate(module_id=F("issue_module__module_id"))