summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitaly_client
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-09-20 15:40:15 -0700
committerMichael Kozono <mkozono@gmail.com>2018-09-24 12:11:27 -0700
commita54a5d9f39df505fe7c68e14c693553bd29bd725 (patch)
treee742f1ddda1caec321b3048032a011c70b784eaf /lib/gitlab/gitaly_client
parent22bf3848ef0e59fb7689bfeab3ba0d8079f1597e (diff)
downloadgitlab-ce-a54a5d9f39df505fe7c68e14c693553bd29bd725.tar.gz
Use `Gitlab::SafeRequestStore` in more places
Even if it doesn’t save lines of code, since people will tend to use code they’ve seen. And `SafeRequestStore` is safer since you don’t have to remember to check `RequestStore.active?`.
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r--lib/gitlab/gitaly_client/commit_service.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb
index 6c95abdcb4b..07e5e204b68 100644
--- a/lib/gitlab/gitaly_client/commit_service.rb
+++ b/lib/gitlab/gitaly_client/commit_service.rb
@@ -240,22 +240,23 @@ module Gitlab
end
def find_commit(revision)
- if RequestStore.active?
- # We don't use RequeStstore.fetch(key) { ... } directly because `revision`
- # can be a branch name, so we can't use it as a key as it could point
- # to another commit later on (happens a lot in tests).
+ if Gitlab::SafeRequestStore.active?
+ # We don't use Gitlab::SafeRequestStore.fetch(key) { ... } directly
+ # because `revision` can be a branch name, so we can't use it as a key
+ # as it could point to another commit later on (happens a lot in
+ # tests).
key = {
storage: @gitaly_repo.storage_name,
relative_path: @gitaly_repo.relative_path,
commit_id: revision
}
- return RequestStore[key] if RequestStore.exist?(key)
+ return Gitlab::SafeRequestStore[key] if Gitlab::SafeRequestStore.exist?(key)
commit = call_find_commit(revision)
return unless commit
key[:commit_id] = commit.id
- RequestStore[key] = commit
+ Gitlab::SafeRequestStore[key] = commit
else
call_find_commit(revision)
end