Skip to content

Commit

Permalink
Use send_after instead of timer send_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Oct 20, 2015
1 parent 4178dfc commit 234995e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/phoenix/transports/websocket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defmodule Phoenix.Transports.WebSocket do

if socket.id, do: socket.endpoint.subscribe(self, socket.id, link: true)

:timer.send_interval(heartbeat, :phoenix_heartbeat)
Process.send_after(self, :phoenix_heartbeat, heartbeat)

{:ok, %{socket: socket,
channels: HashDict.new,
Expand Down Expand Up @@ -154,6 +154,7 @@ defmodule Phoenix.Transports.WebSocket do
if client_unresponsive?(state) do
{:shutdown, state}
else
Process.send_after(self, :phoenix_heartbeat, state.heartbeat_interval)
encode_reply Transport.heartbeat_message(), state
end
end
Expand Down

0 comments on commit 234995e

Please sign in to comment.