mirror of
https://github.com/trafficlunar/api.git
synced 2026-08-12 12:29:39 +00:00
fix: prevent uptimeStart from being -1
This commit is contained in:
parent
42a826a6a8
commit
e858417ae2
1 changed files with 1 additions and 1 deletions
|
|
@ -60,7 +60,7 @@ func HandleComputerWebSocket(w http.ResponseWriter, r *http.Request) {
|
||||||
service.ComputerData.Online = true
|
service.ComputerData.Online = true
|
||||||
|
|
||||||
// If computer has not been seen in the last 45s, start new session
|
// 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())
|
service.ComputerData.UptimeStart = int(time.Now().Unix())
|
||||||
} else {
|
} else {
|
||||||
slog.Info("Continuing existing uptime session")
|
slog.Info("Continuing existing uptime session")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue