Skip to content

Commit e0a225a

Browse files
committed
Merge pull request rails#23916 from lifo/same-redis-connection-for-subscription-and-broadcast
Always use redis_connector to create redis connections
2 parents 364e155 + 4056a9e commit e0a225a

File tree

1 file changed

+6
-2
lines changed
  • actioncable/lib/action_cable/subscription_adapter

1 file changed

+6
-2
lines changed

actioncable/lib/action_cable/subscription_adapter/redis.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def shutdown
3333
end
3434

3535
def redis_connection_for_subscriptions
36-
::Redis.new(@server.config.cable)
36+
redis_connection
3737
end
3838

3939
private
@@ -43,10 +43,14 @@ def listener
4343

4444
def redis_connection_for_broadcasts
4545
@redis_connection_for_broadcasts || @server.mutex.synchronize do
46-
@redis_connection_for_broadcasts ||= self.class.redis_connector.call(@server.config.cable)
46+
@redis_connection_for_broadcasts ||= redis_connection
4747
end
4848
end
4949

50+
def redis_connection
51+
self.class.redis_connector.call(@server.config.cable)
52+
end
53+
5054
class Listener < SubscriberMap
5155
def initialize(adapter)
5256
super()

0 commit comments

Comments
 (0)