Avoid lifecycle history scans in fleet snapshots
This commit is contained in:
@@ -3,6 +3,7 @@ import { config } from '../config.js';
|
||||
import { getServer, listServers } from '../fleet/servers.js';
|
||||
import { hasActiveProvisioning } from '../fleet/provisioning.js';
|
||||
import { latestGameSubmission } from '../fleet/status-evidence.js';
|
||||
import { latestGameSubmissions } from '../fleet/lifecycle-evidence.js';
|
||||
import { rconPlutoniumVersion } from './rcon.js';
|
||||
import { komodoInspectHealthy } from './komodo.js';
|
||||
import { restartRecoveryPending } from '../provisioning/index.js';
|
||||
@@ -23,9 +24,7 @@ export function runningVersions(): PlutoniumVersion[] {
|
||||
const versions = db().prepare('SELECT * FROM plutonium_versions').all() as PlutoniumVersion[];
|
||||
const target = freshRelease();
|
||||
const byServer = new Map(versions.map(version => [version.server, version]));
|
||||
const epochs = new Map((db().prepare(`SELECT server, MAX(at) AS at FROM (
|
||||
SELECT server, submitted_at AS at FROM server_deployments WHERE server_deleted_at IS NULL AND action IN ('create','start','restart','rebuild')
|
||||
UNION ALL SELECT server, requested_at AS at FROM restart_rollout) GROUP BY server`).all() as { server: string; at: string | null }[]).map(row => [row.server, row.at]));
|
||||
const epochs = latestGameSubmissions();
|
||||
const recovering = new Set((db().prepare('SELECT server FROM restart_rollout WHERE healthy_at IS NULL').all() as { server: string }[]).map(row => row.server));
|
||||
return listServers().map(server => {
|
||||
const value = byServer.get(server.name)
|
||||
|
||||
Reference in New Issue
Block a user