diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-02-26 11:45:17 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-02-26 11:45:17 -0700 |
commit | e0a225a3d5bbab1700b6cf071b4b13d8c5d70d5c (patch) | |
tree | 129c1a9929587587353d7b8e3dd1ce707963d980 | |
parent | 364e155f97f3144c06e10f045b7182ed6ee071a1 (diff) | |
parent | 4056a9e8150fdb2390ac5b0e291c23bad75666a6 (diff) | |
download | rails-e0a225a3d5bbab1700b6cf071b4b13d8c5d70d5c.tar.gz rails-e0a225a3d5bbab1700b6cf071b4b13d8c5d70d5c.tar.bz2 rails-e0a225a3d5bbab1700b6cf071b4b13d8c5d70d5c.zip |
Merge pull request #23916 from lifo/same-redis-connection-for-subscription-and-broadcast
Always use redis_connector to create redis connections
-rw-r--r-- | actioncable/lib/action_cable/subscription_adapter/redis.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index ba4934a264..6b4236e7d3 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -33,7 +33,7 @@ module ActionCable end def redis_connection_for_subscriptions - ::Redis.new(@server.config.cable) + redis_connection end private @@ -43,10 +43,14 @@ module ActionCable def redis_connection_for_broadcasts @redis_connection_for_broadcasts || @server.mutex.synchronize do - @redis_connection_for_broadcasts ||= self.class.redis_connector.call(@server.config.cable) + @redis_connection_for_broadcasts ||= redis_connection end end + def redis_connection + self.class.redis_connector.call(@server.config.cable) + end + class Listener < SubscriberMap def initialize(adapter) super() |