mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 13:24:55 +01:00
fix(server): wake interrupted retry cancellation from committed intent
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d8e1bd97f5
commit
bd490ee50b
26 files changed
+858
-55
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { notifyScheduledRetryCancellation } from "../scheduled-retry-cancellation-notifications.js";
|
||||
import { and, eq, sql } from "drizzle-orm";
|
||||
import { heartbeatRuns, nativeRunFinalizations, type Db } from "@paperclipai/db";
|
||||
import { badRequest, conflict } from "../../errors.js";
|
||||
@@ -111,6 +112,7 @@ export async function claimCancellationRequest(db: Db, runId: string, companyId:
|
||||
return run;
|
||||
}
|
||||
if (!pendingRetry && !["queued", "running", "scheduled_retry"].includes(run.status)) throw conflict("Correlated Stop run is already terminal");
|
||||
await notifyScheduledRetryCancellation(tx, { companyId, runId });
|
||||
const [claimed] = await tx.update(heartbeatRuns).set({ resultJson: { ...result,
|
||||
startupCancellation: { requestedAt: new Date().toISOString(), beforeNativeSelection: false, cancellationRequestId: requestId, requestedBy: { type: "board", userId }, ...(run.status === "failed" ? { retryCancellation: true } : {}) },
|
||||
} }).where(and(eq(heartbeatRuns.id, runId), eq(heartbeatRuns.companyId, companyId))).returning();
|
||||
|
||||
Reference in new issue
Block a user