From 57b96eb6db9b860991b035714e65ffd557327b6f Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 19 Sep 2017 13:55:56 +0200 Subject: Fix refreshing of issues/MR count caches This ensures the open issues/MR count caches are refreshed properly when creating new issues or MRs. This MR also includes a change to the cache keys to ensure all caches are rebuilt on the fly. This particular problem was not caught in the test suite due to a null cache being used, resulting in all calls that would use a cache using the underlying data directly. In production the code would fail because a newly saved record returns an empty hash in #changes meaning checks such as `state_changed? || confidential_changed?` would return false for new rows, thus never updating the counters. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38061 --- app/models/merge_request.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'app/models/merge_request.rb') diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 31bd130dcc2..8d9a30397a9 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -958,8 +958,6 @@ class MergeRequest < ActiveRecord::Base end def update_project_counter_caches - return unless update_project_counter_caches? - Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache end -- cgit v1.2.1