From 1975f85cfe6f883373f8deae8ec22ae44a572980 Mon Sep 17 00:00:00 2001 From: Chris McCord Date: Mon, 31 Jan 2022 15:42:41 -0500 Subject: [PATCH] Fix ping --- assets/js/app.js | 2 +- lib/live_beats_web/channels/presence.ex | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index 18adfa1..476cdc1 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -183,7 +183,7 @@ Hooks.Ping = { this.handleEvent("pong", () => { let rtt = Date.now() - this.nowMs this.el.innerText = `ping: ${rtt}ms` - this.timer = setTimeout(() => this.ping(rtt), 100) + this.timer = setTimeout(() => this.ping(rtt), 1000) }) this.ping(null) }, diff --git a/lib/live_beats_web/channels/presence.ex b/lib/live_beats_web/channels/presence.ex index 1510917..ede5a82 100644 --- a/lib/live_beats_web/channels/presence.ex +++ b/lib/live_beats_web/channels/presence.ex @@ -93,7 +93,6 @@ defmodule LiveBeatsWeb.Presence.BadgeComponent do def update(%{action: {:ping, action}}, socket) do %{user: user, ping: ping, region: region} = action - {:ok, assign(socket, presence: user, ping: ping, region: region)} end