Fix fleet stale-status flicker during polling
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { parseServerName, zombieMapBySlug } from './map-aliases.js';
|
||||
import { freshStatusTimestamp } from './server-freshness.js';
|
||||
import type { ZombieGame } from './map-aliases.js';
|
||||
import type { RoundTelemetry } from './telemetry.js';
|
||||
import type { Health, RosterPlayer } from './ui/stores/servers.js';
|
||||
@@ -40,8 +41,7 @@ export type FleetFilter = 'all' | 'occupied' | 'empty' | 'attention' | 'testing'
|
||||
export type FleetSort = 'name' | 'players' | 'round' | 'duration';
|
||||
|
||||
export function freshServer(server: FleetServer, now: number): boolean {
|
||||
const age = now - Date.parse(server.last_seen_at ?? '');
|
||||
return server.health === 'online' && age >= 0 && age <= 30_000;
|
||||
return server.health === 'online' && !server.last_error && freshStatusTimestamp(server.last_seen_at, now);
|
||||
}
|
||||
|
||||
export function fleetIdentity(server: FleetServer) {
|
||||
|
||||
Reference in New Issue
Block a user