Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 15:10:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 15:10:16 +0300
commit5c8c561ac63d7b8f372316b4409500474220fcda (patch)
tree20586ba87f12052ee507171b07f61dd21d9f1fd8 /lib/gitlab/with_request_store.rb
parentb1b7c2f9a744197a111c81719c546a474adab4e8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/with_request_store.rb')
-rw-r--r--lib/gitlab/with_request_store.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/with_request_store.rb b/lib/gitlab/with_request_store.rb
index d6c05e1e256..d13cd9a72f7 100644
--- a/lib/gitlab/with_request_store.rb
+++ b/lib/gitlab/with_request_store.rb
@@ -2,12 +2,24 @@
module Gitlab
module WithRequestStore
- def with_request_store
+ def with_request_store(&block)
+ # Skip enabling the request store if it was already active. Whatever
+ # instantiated the request store first is responsible for clearing it
+ return yield if RequestStore.active?
+
+ enabling_request_store(&block)
+ end
+
+ private
+
+ def enabling_request_store
RequestStore.begin!
yield
ensure
RequestStore.end!
RequestStore.clear!
end
+
+ extend self
end
end