Add cancellation for collection launches

This commit is contained in:
2026-10-07 15:32:02 -04:00
parent 062ade8655
commit db92c89b05
10 changed files with 501 additions and 28 deletions
@@ -0,0 +1,15 @@
import { json } from '@sveltejs/kit';
import { cancelCollection } from '$lib/server/fleet/collections.js';
import { db } from '$lib/server/db/index.js';
import { kickProvisioning } from '$lib/server/pipeline/worker.js';
export function POST({ params }: { params: { id: string } }) {
if (!db().prepare('SELECT 1 FROM server_launch_collections WHERE id=?').get(params.id)) {
return json({ error: 'Collection not found.' }, { status: 404 });
}
if (!cancelCollection(params.id)) {
return json({ error: 'This collection has no work that can still be cancelled. Refresh to see its current state.' }, { status: 409 });
}
void kickProvisioning();
return json({ ok: true });
}