blob: b21bee459917a0ffe6d5a19855b44c326b8d152f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# frozen_string_literal: true
# Modifies https://github.com/rails/rails/blob/v6.1.4.6/actioncable/lib/action_cable/subscription_adapter/redis.rb
# so that it is resilient to Redis connection errors.
# See https://github.com/rails/rails/issues/27659.
# rubocop:disable Gitlab/ModuleWithInstanceVariables
module Gitlab
module Patch
module ActionCableRedisListener
private
def ensure_listener_running
@thread ||= Thread.new do
Thread.current.abort_on_exception = true
conn = @adapter.redis_connection_for_subscriptions
listen conn
rescue ::Redis::BaseConnectionError
@thread = @raw_client = nil
::ActionCable.server.restart
end
end
end
end
end
|