summaryrefslogtreecommitdiff
path: root/lib/gitlab/action_cable
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-09 18:11:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-09 18:11:44 +0000
commit764ecdaf4d65cb5730b7487ed8620bcf21e6b7d7 (patch)
treebb90d07ba6ef43685b785b6964d567732f575d7b /lib/gitlab/action_cable
parenta3596259bcca06bf4adcdb391d0ea3110fe7deff (diff)
downloadgitlab-ce-764ecdaf4d65cb5730b7487ed8620bcf21e6b7d7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/action_cable')
-rw-r--r--lib/gitlab/action_cable/request_store_callbacks.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gitlab/action_cable/request_store_callbacks.rb b/lib/gitlab/action_cable/request_store_callbacks.rb
new file mode 100644
index 00000000000..a9f30b0fc10
--- /dev/null
+++ b/lib/gitlab/action_cable/request_store_callbacks.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module ActionCable
+ module RequestStoreCallbacks
+ def self.install
+ ::ActionCable::Server::Worker.set_callback :work, :around, &wrapper
+ ::ActionCable::Channel::Base.set_callback :subscribe, :around, &wrapper
+ ::ActionCable::Channel::Base.set_callback :unsubscribe, :around, &wrapper
+ end
+
+ def self.wrapper
+ lambda do |_, inner|
+ ::Gitlab::WithRequestStore.with_request_store do
+ inner.call
+ end
+ end
+ end
+ end
+ end
+end