Fix rebuild generation reconciliation (Refs #155)

This commit is contained in:
2026-10-14 12:36:32 -04:00
parent 61dbfb2c5f
commit dedf15d9af
17 changed files with 672 additions and 43 deletions
+5 -3
View File
@@ -7,9 +7,10 @@ export function latestGameSubmission(server: string): string | null {
.prepare(
`SELECT MAX(at) AS at FROM (
SELECT MAX(submitted_at) AS at FROM server_deployments WHERE server=? AND server_deleted_at IS NULL AND action IN ('create','start','restart','rebuild')
UNION ALL SELECT requested_at AS at FROM restart_rollout WHERE server=?)`
UNION ALL SELECT requested_at AS at FROM restart_rollout WHERE server=?
UNION ALL SELECT generation_reconciled_at AS at FROM native_instances WHERE server=? AND retired_at IS NULL)`
)
.get(server, server) as { at: string | null }
.get(server, server, server) as { at: string | null }
).at;
}
@@ -21,7 +22,8 @@ export function latestGameSubmissions(): Map<string, string | null> {
SELECT s.name AS server, (SELECT MAX(submitted_at) FROM server_deployments
WHERE server=s.name AND server_deleted_at IS NULL AND action IN ('create','start','restart','rebuild')) AS at
FROM servers s
UNION ALL SELECT server, requested_at AS at FROM restart_rollout) GROUP BY server`
UNION ALL SELECT server, requested_at AS at FROM restart_rollout
UNION ALL SELECT server, generation_reconciled_at AS at FROM native_instances WHERE retired_at IS NULL) GROUP BY server`
)
.all() as { server: string; at: string | null }[];
return new Map(rows.map((row) => [row.server, row.at]));