debian-mirror-gitlab/lib/gitlab/action_cable/request_store_callbacks.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
559 B
Ruby
Raw Normal View History

2021-11-11 11:23:49 +05:30
# 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