Cancel active provisioning jobs when rolling back betas

This commit is contained in:
2026-10-05 17:48:46 -04:00
parent 6ad5e7f4c6
commit 701066aaf8
25 changed files with 564 additions and 37 deletions
@@ -1,14 +1,9 @@
import { json } from '@sveltejs/kit';
import { cancelRemoval } from '$lib/server/provisioning/history.js';
import { cancelCreation } from '$lib/server/provisioning/cancel-creation.js';
import { cancelProvisioningJob } from '$lib/server/provisioning/cancellation.js';
import { kickProvisioning } from '$lib/server/pipeline/worker.js';
export function POST({ params }: { params: { id: string } }) {
const cleanupId = cancelCreation(params.id);
if (cleanupId) {
void kickProvisioning();
return json({ ok: true, cleanupId });
}
if (!cancelRemoval(params.id)) return json({ error: 'This operation can no longer be cancelled. Refresh to see its current state.' }, { status: 409 });
if (!cancelProvisioningJob(params.id)) return json({ error: 'This operation can no longer be cancelled. Refresh to see its current state.' }, { status: 409 });
void kickProvisioning();
return json({ ok: true });
}