add log message when removing stale client

This commit is contained in:
Sebastian Mark 2024-11-21 08:57:43 +01:00
parent 83e5d68be5
commit 0c89ff3224

View file

@ -3,6 +3,7 @@ package websocket
import ( import (
"time" "time"
"git.smsvc.net/pomodoro/GoTomato/internal/helper"
"git.smsvc.net/pomodoro/GoTomato/pkg/models" "git.smsvc.net/pomodoro/GoTomato/pkg/models"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
) )
@ -33,6 +34,7 @@ func RemoveStaleClients() {
if !sendPing(client) || isStale(client) { if !sendPing(client) || isStale(client) {
client.Conn.Close() client.Conn.Close()
delete(Clients, client.Conn.LocalAddr()) delete(Clients, client.Conn.LocalAddr())
helper.Logger.Info("Removed stale client", "host", client.RealIP, "clients", len(Clients))
} }
} }
mu.Unlock() mu.Unlock()