diff options
author | Matthew Draper <matthew@trebex.net> | 2016-01-28 15:25:31 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-01-30 03:46:37 +1030 |
commit | 74497eabd52f2f9f8c383808b11286283046c2b2 (patch) | |
tree | fe2b2cb0d7c4066449fc7e0426d49cad0d2f91e6 /actioncable/lib/action_cable/server | |
parent | c8818dfcdf9e92364745000eefe46132a43f8700 (diff) | |
download | rails-74497eabd52f2f9f8c383808b11286283046c2b2.tar.gz rails-74497eabd52f2f9f8c383808b11286283046c2b2.tar.bz2 rails-74497eabd52f2f9f8c383808b11286283046c2b2.zip |
Revert "Revert "Eliminate the EventMachine dependency""
Diffstat (limited to 'actioncable/lib/action_cable/server')
-rw-r--r-- | actioncable/lib/action_cable/server/base.rb | 4 | ||||
-rw-r--r-- | actioncable/lib/action_cable/server/connections.rb | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/actioncable/lib/action_cable/server/base.rb b/actioncable/lib/action_cable/server/base.rb index 3385a4c9f3..b00abd208c 100644 --- a/actioncable/lib/action_cable/server/base.rb +++ b/actioncable/lib/action_cable/server/base.rb @@ -32,6 +32,10 @@ module ActionCable @remote_connections ||= RemoteConnections.new(self) end + def stream_event_loop + @stream_event_loop ||= ActionCable::Connection::StreamEventLoop.new + end + # The thread worker pool for handling all the connection work on this server. Default size is set by config.worker_pool_size. def worker_pool @worker_pool ||= ActionCable::Server::Worker.new(max_size: config.worker_pool_size) diff --git a/actioncable/lib/action_cable/server/connections.rb b/actioncable/lib/action_cable/server/connections.rb index 47dcea8c20..8671dd5ebd 100644 --- a/actioncable/lib/action_cable/server/connections.rb +++ b/actioncable/lib/action_cable/server/connections.rb @@ -22,11 +22,9 @@ module ActionCable # then can't rely on being able to receive and send to it. So there's a 3 second heartbeat running on all connections. If the beat fails, we automatically # disconnect. def setup_heartbeat_timer - EM.next_tick do - @heartbeat_timer ||= EventMachine.add_periodic_timer(BEAT_INTERVAL) do - EM.next_tick { connections.map(&:beat) } - end - end + @heartbeat_timer ||= Concurrent::TimerTask.new(execution_interval: BEAT_INTERVAL) do + Concurrent.global_io_executor.post { connections.map(&:beat) } + end.tap(&:execute) end def open_connections_statistics |