summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-28 02:24:16 +0000
committerStan Hu <stanhu@gmail.com>2018-09-28 02:24:16 +0000
commitb0b5346d65b24bad188f3ef4a8f282ac07bf1136 (patch)
treea91ff1d8bc97f3723c95623f8b2aeba9480c21f7 /app/models
parentc02057b4c877e664f16708628723509ca0b5e506 (diff)
parentf2fa7c10c8490a31863c9bd21bbfd66675e3c909 (diff)
downloadgitlab-ce-b0b5346d65b24bad188f3ef4a8f282ac07bf1136.tar.gz
Merge branch 'mk/asymmetric-exists-cache' into 'master'
Resolve "Geo: Does not mark repositories as missing on primary due to stale cache" Closes #50211 and #44044 See merge request gitlab-org/gitlab-ce!21789
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 12fbf7d5d1d..4fecdb3c1ad 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -510,7 +510,7 @@ class Repository
raw_repository.exists?
end
- cache_method :exists?
+ cache_method_asymmetrically :exists?
# We don't need to cache the output of this method because both exists? and
# has_visible_content? are already memoized and cached. There's no guarantee
@@ -612,7 +612,7 @@ class Repository
Licensee::License.new(license_key)
end
- cache_method :license, memoize_only: true
+ memoize_method :license
def gitignore
file_on_head(:gitignore)
@@ -1029,6 +1029,10 @@ class Repository
@cache ||= Gitlab::RepositoryCache.new(self)
end
+ def request_store_cache
+ @request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore)
+ end
+
def tags_sorted_by_committed_date
tags.sort_by do |tag|
# Annotated tags can point to any object (e.g. a blob), but generally