retryJob
uses tcmts.studio.editableCodebase, which uses tcmts.share.servedCodebase, which uses process
Queue job id again, now, as tcm jobs retry does: its attempts and last error cleared.
import { HttpError } from "#codebase/tcmts/server"; import { editableCodebase, withJobs } from "#codebase/tcmts/studio"; export async function retryJob(id: string): Promise<void> { const cb = editableCodebase(); const n = withJobs( cb, (db) => db .prepare( "UPDATE jobs SET status = 'queued', run_at = ?, attempts = 0, last_error = NULL, finished = NULL WHERE id = ?", ) .run(Date.now(), id).changes, true, ); if (!n) throw new HttpError(404, `There's no job ${id}.`); }