2020-03-17 17:09:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
require 'action_cable/subscription_adapter/redis'
|
|
|
|
|
2020-03-17 17:09:16 -04:00
|
|
|
Rails.application.configure do
|
2021-10-27 08:09:41 -04:00
|
|
|
config.action_cable.mount_path = '/-/cable'
|
2020-07-08 02:09:13 -04:00
|
|
|
|
2020-03-17 17:09:16 -04:00
|
|
|
config.action_cable.url = Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/cable')
|
2020-07-08 02:09:13 -04:00
|
|
|
config.action_cable.worker_pool_size = Gitlab::ActionCable::Config.worker_pool_size
|
2020-03-17 17:09:16 -04:00
|
|
|
end
|
2020-06-04 08:08:21 -04:00
|
|
|
|
2021-11-24 16:12:47 -05:00
|
|
|
ActionCable::SubscriptionAdapter::Base.prepend(Gitlab::Patch::ActionCableSubscriptionAdapterIdentifier)
|
2022-03-04 10:16:11 -05:00
|
|
|
ActionCable::SubscriptionAdapter::Redis::Listener.prepend(Gitlab::Patch::ActionCableRedisListener)
|
2021-11-24 16:12:47 -05:00
|
|
|
|
2020-06-04 08:08:21 -04:00
|
|
|
# https://github.com/rails/rails/blob/bb5ac1623e8de08c1b7b62b1368758f0d3bb6379/actioncable/lib/action_cable/subscription_adapter/redis.rb#L18
|
|
|
|
ActionCable::SubscriptionAdapter::Redis.redis_connector = lambda do |config|
|
|
|
|
args = config.except(:adapter, :channel_prefix)
|
|
|
|
.merge(instrumentation_class: ::Gitlab::Instrumentation::Redis::ActionCable)
|
|
|
|
|
|
|
|
::Redis.new(args)
|
|
|
|
end
|
2021-09-09 14:11:44 -04:00
|
|
|
|
|
|
|
Gitlab::ActionCable::RequestStoreCallbacks.install
|
2021-09-21 14:11:18 -04:00
|
|
|
Gitlab::Database::LoadBalancing::ActionCableCallbacks.install
|