debian-mirror-gitlab/config/initializers/action_cable.rb

25 lines
1 KiB
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
2020-06-23 00:09:42 +05:30
require 'action_cable/subscription_adapter/redis'
2020-05-24 23:13:21 +05:30
Rails.application.configure do
2021-12-11 22:18:48 +05:30
config.action_cable.mount_path = '/-/cable'
2020-07-28 23:09:34 +05:30
2020-05-24 23:13:21 +05:30
config.action_cable.url = Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/cable')
2020-07-28 23:09:34 +05:30
config.action_cable.worker_pool_size = Gitlab::ActionCable::Config.worker_pool_size
2020-05-24 23:13:21 +05:30
end
2020-06-23 00:09:42 +05:30
2021-12-11 22:18:48 +05:30
ActionCable::SubscriptionAdapter::Base.prepend(Gitlab::Patch::ActionCableSubscriptionAdapterIdentifier)
2022-05-07 20:08:51 +05:30
ActionCable::SubscriptionAdapter::Redis::Listener.prepend(Gitlab::Patch::ActionCableRedisListener)
2021-12-11 22:18:48 +05:30
2020-06-23 00:09:42 +05:30
# 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-11-11 11:23:49 +05:30
Gitlab::ActionCable::RequestStoreCallbacks.install
2021-11-18 22:05:49 +05:30
Gitlab::Database::LoadBalancing::ActionCableCallbacks.install