diff --git a/internal/websocket/staleClients.go b/internal/websocket/staleClients.go index 6ba2128..d64960e 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()) }