diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-01-24 16:00:15 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-01-24 16:00:15 +0100 |
commit | 53a9da4cf2d99c73bb2b71c84098c9fe32d3cedc (patch) | |
tree | 631e1157afb6bfe4e0e5c4ffdc4a69ef6a713f1b /actioncable/lib/action_cable/server/connections.rb | |
parent | 3bebb65e86baac1792499c94679a4d4a0cc4acbd (diff) | |
parent | 503fe757c7f5f917deab95acdcd421a1dede05c7 (diff) | |
download | rails-53a9da4cf2d99c73bb2b71c84098c9fe32d3cedc.tar.gz rails-53a9da4cf2d99c73bb2b71c84098c9fe32d3cedc.tar.bz2 rails-53a9da4cf2d99c73bb2b71c84098c9fe32d3cedc.zip |
Merge pull request #23152 from matthewd/actioncable-concurrent
Eliminate the EventMachine dependency
Diffstat (limited to 'actioncable/lib/action_cable/server/connections.rb')
-rw-r--r-- | actioncable/lib/action_cable/server/connections.rb | 8 |
1 files changed, 3 insertions, 5 deletions
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 |