Use cached values to compute total issues count in milestone index pages
What does this MR do?
Milestoneish#issues_visible_to_user
caches only the ActiveRecord relation,
not the actual result.
Introduce Milestoneish#total_issues_count
that relies on the cached method
Milestoneish#count_issues_by_state
to reduce the number of queries.
It's basically a follow-up to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8146.
Versions affected
8.13, 8.14. 8.15
Why was this MR needed?
Performance issues described in https://gitlab.com/gitlab-org/gitlab-ce/issues/25748.
Does this MR meet the acceptance criteria?
-
Changelog entry added [ ] Documentation created/updated[ ] API support added- Tests
[ ] Added for this feature/bug-
All builds are passing
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Refers to https://gitlab.com/gitlab-org/gitlab-ce/issues/25748