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
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:
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
I don't particularly like it myself, but I want to know what others think.
Maybe the better approach for #31289 will be to add
issue_counts directly to releases API and duplicate some logic from
but this MR still can be usefull for optimizing of
Does this MR meet the acceptance criteria?
- 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
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
- 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