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()) }