mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-29 12:00:32 +00:00
20 lines
472 B
Ruby
20 lines
472 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module ActionCable
|
|
module IpAddressStateCallback
|
|
def self.install
|
|
::ActionCable::Server::Worker.set_callback :work, :around, &wrapper
|
|
end
|
|
|
|
def self.wrapper
|
|
->(_, inner) do
|
|
::Gitlab::IpAddressState.with(connection.request.ip) do # rubocop: disable CodeReuse/ActiveRecord -- not an ActiveRecord object
|
|
inner.call
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|