diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-25 16:26:22 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-30 16:49:40 +0300 |
commit | c158a22fd3cc5c3d60b5e0e1bf44f8aa75617d70 (patch) | |
tree | 666ae3be074ad07b8b056d5b19e931600526a39b /app/models/issue.rb | |
parent | 9e7e0496ff639d1eec65dcbf1b51edb2262456e2 (diff) |
Only update the sidebar count caches when needed
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/issue.rb')
-rw-r--r-- | app/models/issue.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index b9aa937d2f9..dfcd4030ec3 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -269,7 +269,13 @@ class Issue < ActiveRecord::Base end end + def update_project_counter_caches? + state_changed? || confidential_changed? + end + def update_project_counter_caches + return unless update_project_counter_caches? + Projects::OpenIssuesCountService.new(project).refresh_cache end |