fix: prevent uptimeStart from being -1

This commit is contained in:
trafficlunar 2026-07-09 11:43:01 +01:00
parent 42a826a6a8
commit e858417ae2

View file

@ -60,7 +60,7 @@ func HandleComputerWebSocket(w http.ResponseWriter, r *http.Request) {
service.ComputerData.Online = true
// If computer has not been seen in the last 45s, start new session
if time.Since(lastSeen) > 45*time.Second {
if time.Since(lastSeen) > 45*time.Second || service.ComputerData.UptimeStart == -1 {
service.ComputerData.UptimeStart = int(time.Now().Unix())
} else {
slog.Info("Continuing existing uptime session")