Fix fleet stale-status flicker during polling

This commit is contained in:
2026-09-18 15:11:49 -04:00
parent f54cac8c50
commit 6d903adb31
6 changed files with 59 additions and 12 deletions
+10
View File
@@ -0,0 +1,10 @@
// Allow a polling cycle plus time for queued RCON requests and delivery.
export const STATUS_REFRESH_MS = 30_000;
export const ONLINE_MAX_MS = STATUS_REFRESH_MS + 15_000;
// The UI clock ticks once per second and can trail a newly arrived report.
const CLOCK_TOLERANCE_MS = 1_000;
export function freshStatusTimestamp(timestamp: string | null, now: number): boolean {
const age = now - Date.parse(timestamp ?? '');
return age >= -CLOCK_TOLERANCE_MS && age <= ONLINE_MAX_MS;
}