diff options
author | Sean McGivern <sean@gitlab.com> | 2017-08-31 12:21:39 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-08-31 12:21:39 +0100 |
commit | e7817fc1e0877efd59f0442934bbb0ad91fbb20a (patch) | |
tree | 6d0502e8a9c2af5a9d962deb40ad4b2216b84b69 /app/services | |
parent | f35d7d7f6ea04a38da822db902ad24108dfe94a2 (diff) | |
download | gitlab-ce-e7817fc1e0877efd59f0442934bbb0ad91fbb20a.tar.gz |
Remove issuable finder count caching
We're going to cache the total open count separately, and then just perform
these counts on the list. We already do that to get the pagination information,
through Kaminari, and a future change will make Kaminari reuse the query results
from earlier in the request.
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 1486db046b5..063f7bc28d0 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -244,9 +244,7 @@ class IssuableBaseService < BaseService new_assignees = issuable.assignees.to_a affected_assignees = (old_assignees + new_assignees) - (old_assignees & new_assignees) - # Don't clear the project cache, because it will be handled by the - # appropriate service (close / reopen / merge / etc.). - invalidate_cache_counts(issuable, users: affected_assignees.compact, skip_project_cache: true) + invalidate_cache_counts(issuable, users: affected_assignees.compact) after_update(issuable) issuable.create_new_cross_references!(current_user) execute_hooks(issuable, 'update') @@ -340,18 +338,9 @@ class IssuableBaseService < BaseService create_labels_note(issuable, old_labels) if issuable.labels != old_labels end - def invalidate_cache_counts(issuable, users: [], skip_project_cache: false) + def invalidate_cache_counts(issuable, users: []) users.each do |user| user.public_send("invalidate_#{issuable.model_name.singular}_cache_counts") # rubocop:disable GitlabSecurity/PublicSend end - - unless skip_project_cache - case issuable - when Issue - IssuesFinder.new(nil, project_id: issuable.project_id).clear_caches! - when MergeRequest - MergeRequestsFinder.new(nil, project_id: issuable.target_project_id).clear_caches! - end - end end end |