summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-12-06 13:22:45 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-12-06 13:41:28 +0100
commit5eb12bd75fff65bb2ea8677cc317877e45d3d6f8 (patch)
tree121c7e78aa6449cdf1a5ecc5c4dff44cb17737cd /app
parent18201ace36f13eb916737154178d700feb4eeec6 (diff)
downloadgitlab-ce-5eb12bd75fff65bb2ea8677cc317877e45d3d6f8.tar.gz
Remove caching of Repository#has_visible_content?remove-has-visible-content-caching
This method already uses the cached method Repository#branch_count so there's no point in also caching has_visible_content?. Fixes gitlab-org/gitlab-ce#25278
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb14
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