diff options
author | Valery Sizov <valery@gitlab.com> | 2017-05-15 15:04:09 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-05-15 22:51:53 +0300 |
commit | a6c0eb54dc23931aaa6dd5630bee036c62f86ff5 (patch) | |
tree | 9d8f2eeb55ccdede3c7ebfe7a7651708e7813da9 /app/services | |
parent | e261b4b8517ba6d5d5b082f1955836c945fd51fc (diff) |
Invalidate cache for issue and MR counters more granularly
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index dc2ab99b982..5ad4b2a9adf 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -179,6 +179,7 @@ class IssuableBaseService < BaseService issuable.create_cross_references!(current_user) execute_hooks(issuable) issuable.assignees.each(&:invalidate_cache_counts) + invalidate_cache_counts(issuable.assignees, issuable) end issuable @@ -237,7 +238,7 @@ class IssuableBaseService < BaseService if old_assignees != issuable.assignees assignees = old_assignees + issuable.assignees.to_a - assignees.compact.each(&:invalidate_cache_counts) + invalidate_cache_counts(assignees.compact, issuable) end after_update(issuable) @@ -330,4 +331,10 @@ class IssuableBaseService < BaseService create_labels_note(issuable, old_labels) if issuable.labels != old_labels end + + def invalidate_cache_counts(users, issuable) + users.each do |user| + user.public_send("invalidate_#{issuable.model_name.singular}_cache_counts") + end + end end |