WIP: Discussion: Add preload_issue_counts method to milestoneish
What does this MR do?
We want to show open/closed issue counts one the releases page: #31289 (closed)
That was implemented by adding issue_counts
to milestones in the API: !18579 (diffs)
But this approach added N+1 problem(we were collecting issue counts for every milestone), which is currently exist on the milestones page:
https://gitlab.com/groups/gitlab-org/-/milestones
The original suggestion was to cache these counts, but it has a few problems, including
counts depend on user permissions, so there are too many conditions for cache invalidation
This MR tries to avoid N+1 for collecting issue counts by using an approach similar to preload
.
I don't particularly like it myself, but I want to know what others think.
Maybe the better approach for #31289 (closed) will be to add issue_counts
directly to releases API and duplicate some logic from milestoneish
,
but this MR still can be usefull for optimizing of milestones
page.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #31289 (closed)