diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-12-07 00:52:18 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-12-07 00:52:18 +0000 |
commit | ff02c63cd3cfbaebb16ed770e377ae318c6be054 (patch) | |
tree | b889a3fab70a38b7fb3502167797df4588a8cd1d /app | |
parent | 73a066c216815f6b4faf9b186b917c3486b6d6e0 (diff) | |
parent | 5eb12bd75fff65bb2ea8677cc317877e45d3d6f8 (diff) | |
download | gitlab-ce-ff02c63cd3cfbaebb16ed770e377ae318c6be054.tar.gz |
Merge branch 'remove-has-visible-content-caching' into 'master'
Remove caching of Repository#has_visible_content?
This MR removes the caching of `Repository#has_visible_content?`. The cache for this method is no longer necessary and this should solve the problem described in https://gitlab.com/gitlab-org/gitlab-ce/issues/25278.
See merge request !7947
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index e2e7d08abac..3c4b0212af7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -85,11 +85,7 @@ class Repository # This method return true if repository contains some content visible in project page. # def has_visible_content? - return @has_visible_content unless @has_visible_content.nil? - - @has_visible_content = cache.fetch(:has_visible_content?) do - branch_count > 0 - end + branch_count > 0 end def commit(ref = 'HEAD') @@ -374,12 +370,6 @@ class Repository return unless empty? expire_method_caches(%i(empty?)) - expire_has_visible_content_cache - end - - def expire_has_visible_content_cache - cache.expire(:has_visible_content?) - @has_visible_content = nil end def lookup_cache @@ -467,7 +457,6 @@ class Repository # Runs code after a new branch has been created. def after_create_branch expire_branches_cache - expire_has_visible_content_cache repository_event(:push_branch) end @@ -481,7 +470,6 @@ class Repository # Runs code after an existing branch has been removed. def after_remove_branch - expire_has_visible_content_cache expire_branches_cache end |