diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-01-06 17:16:02 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-01-18 18:58:57 -0500 |
commit | 0016e0410b11d40a1d730a1232c40f428d67abeb (patch) | |
tree | 172b2fe1e0e2424a2eab33c95ec38487d5b5996d /actioncable/lib/action_cable/server/base.rb | |
parent | 75f1b229fdb340b2cdaf632bb6a223213f05dc75 (diff) | |
download | rails-0016e0410b11d40a1d730a1232c40f428d67abeb.tar.gz rails-0016e0410b11d40a1d730a1232c40f428d67abeb.tar.bz2 rails-0016e0410b11d40a1d730a1232c40f428d67abeb.zip |
Adapterize ActionCable storage and extract behavior
Diffstat (limited to 'actioncable/lib/action_cable/server/base.rb')
-rw-r--r-- | actioncable/lib/action_cable/server/base.rb | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb index 3785bbd154..6539745c79 100644 --- a/actioncable/lib/action_cable/server/base.rb +++ b/actioncable/lib/action_cable/server/base.rb @@ -1,5 +1,3 @@ -require 'em-hiredis' - module ActionCable module Server # A singleton ActionCable::Server instance is available via ActionCable.server. It's used by the rack process that starts the cable server, but @@ -47,20 +45,9 @@ module ActionCable end end - # The redis pubsub adapter used for all streams/broadcasting. + # The pubsub adapter used for all streams/broadcasting. def pubsub - @pubsub ||= redis.pubsub - end - - # The EventMachine Redis instance used by the pubsub adapter. - def redis - @redis ||= EM::Hiredis.connect(config.redis[:url]).tap do |redis| - redis.on(:reconnect_failed) do - logger.info "[ActionCable] Redis reconnect failed." - # logger.info "[ActionCable] Redis reconnected. Closing all the open connections." - # @connections.map &:close - end - end + @pubsub ||= config.storage_adapter.new(self).pubsub end # All the identifiers applied to the connection class associated with this server. |