diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-25 15:26:22 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-30 15:49:40 +0200 |
commit | c158a22fd3cc5c3d60b5e0e1bf44f8aa75617d70 (patch) | |
tree | 666ae3be074ad07b8b056d5b19e931600526a39b /app/models/merge_request.rb | |
parent | 9e7e0496ff639d1eec65dcbf1b51edb2262456e2 (diff) | |
download | gitlab-ce-sidebar-cache-updates.tar.gz |
Only update the sidebar count caches when neededsidebar-cache-updates
This ensures the issues/MR cache of the sidebar is only updated when the
state or confidential flags changes, instead of changing this for every
update.
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 7f73de67625..764bc08923e 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -942,7 +942,13 @@ class MergeRequest < ActiveRecord::Base true end + def update_project_counter_caches? + state_changed? + end + def update_project_counter_caches + return unless update_project_counter_caches? + Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache end |