From 58ac2d2950367072e53792b574bc987c302eec6c Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Thu, 21 Nov 2024 08:47:58 +0100 Subject: [PATCH] merge ping and stale check --- internal/websocket/staleClients.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/websocket/staleClients.go b/internal/websocket/staleClients.go index a4a9a31..58acea2 100644 --- a/internal/websocket/staleClients.go +++ b/internal/websocket/staleClients.go @@ -30,13 +30,7 @@ func RemoveStaleClients() { for range ticker.C { mu.Lock() for _, client := range Clients { - if !sendPing(client) { - client.Conn.Close() - delete(Clients, client.Conn.LocalAddr()) - - } - - if isStale(client) { + if !sendPing(client) || isStale(client) { client.Conn.Close() delete(Clients, client.Conn.LocalAddr()) }