diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2016-02-26 12:31:14 -0600 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2016-02-26 12:31:14 -0600 |
commit | 4056a9e8150fdb2390ac5b0e291c23bad75666a6 (patch) | |
tree | bea59a2821ae93cb150e8ce7554af13e4c96277d /actioncable/lib/action_cable/subscription_adapter | |
parent | c57e7239a8b82957bcb07534cb7c1a3dcef71864 (diff) | |
download | rails-4056a9e8150fdb2390ac5b0e291c23bad75666a6.tar.gz rails-4056a9e8150fdb2390ac5b0e291c23bad75666a6.tar.bz2 rails-4056a9e8150fdb2390ac5b0e291c23bad75666a6.zip |
Use redis_connector to create redis connections for both subscriptions and broadcasts
Diffstat (limited to 'actioncable/lib/action_cable/subscription_adapter')
-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() |