Skip to content

Commit 5358029

Browse files
committed
If the run has been canceled during execution, don’t do any further processing of the run
1 parent de0e44c commit 5358029

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/webapp/app/services/runs/performRunExecutionV3.server.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,18 @@ export class PerformRunExecutionV3Service {
207207

208208
forceYieldCoordinator.deregisterRun(run.id);
209209

210-
//todo if cancelled then return
210+
//if the run has been canceled while it's being executed, we shouldn't do anything more
211+
const updatedRun = await this.#prismaClient.jobRun.findUnique({
212+
select: {
213+
status: true,
214+
},
215+
where: {
216+
id: run.id,
217+
},
218+
});
219+
if (!updatedRun || updatedRun.status === "CANCELED") {
220+
return;
221+
}
211222

212223
if (!response) {
213224
return await this.#failRunExecutionWithRetry(

0 commit comments

Comments
 (0)