aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/server/connections.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_cable/server/connections.rb')
-rw-r--r--lib/action_cable/server/connections.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/action_cable/server/connections.rb b/lib/action_cable/server/connections.rb
index 455ff1ab29..4a5e21f5fd 100644
--- a/lib/action_cable/server/connections.rb
+++ b/lib/action_cable/server/connections.rb
@@ -22,8 +22,10 @@ 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
- @heartbeat_timer ||= EventMachine.add_periodic_timer(BEAT_INTERVAL) do
- EM.next_tick { connections.map &:beat }
+ @heartbeat_timer ||= EM.next_tick do
+ EventMachine.add_periodic_timer(BEAT_INTERVAL) do
+ EM.next_tick { connections.map &:beat }
+ end
end
end