2020-03-17 21:09:16 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-04 12:08:21 +00:00
|
|
|
require 'action_cable/subscription_adapter/redis'
|
|
|
|
|
2020-03-17 21:09:16 +00:00
|
|
|
Rails.application.configure do
|
2020-06-10 18:09:15 +00:00
|
|
|
# We only mount the ActionCable engine in tests where we run it in-app
|
|
|
|
# For other environments, we run it on a standalone Puma server
|
|
|
|
config.action_cable.mount_path = Rails.env.test? ? '/-/cable' : nil
|
2020-03-17 21:09:16 +00:00
|
|
|
config.action_cable.url = Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, '/-/cable')
|
2020-05-03 21:09:39 +00:00
|
|
|
config.action_cable.worker_pool_size = Gitlab.config.action_cable.worker_pool_size
|
2020-03-17 21:09:16 +00:00
|
|
|
end
|
2020-06-04 12:08:21 +00: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
|