Skip to content

Commit ce35090

Browse files
committed
CrashTaskRunService using FinalizeTaskRunService
1 parent 28beafd commit ce35090

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

apps/webapp/app/v3/services/crashTaskRun.server.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AuthenticatedEnvironment } from "~/services/apiAuth.server";
77
import { ResumeTaskRunDependenciesService } from "./resumeTaskRunDependencies.server";
88
import { CRASHABLE_ATTEMPT_STATUSES, isCrashableRunStatus } from "../taskStatus";
99
import { sanitizeError } from "@trigger.dev/core/v3";
10+
import { FinalizeTaskRunService } from "./finalizeTaskRun.server";
1011

1112
export type CrashTaskRunServiceOptions = {
1213
reason?: string;
@@ -59,18 +60,12 @@ export class CrashTaskRunService extends BaseService {
5960
- logs/stacktrace
6061
*/
6162

62-
// Remove the task run from the queue if it's there for some reason
63-
await marqs?.acknowledgeMessage(taskRun.id);
64-
65-
// Set the task run status to crashed
66-
const crashedTaskRun = await this._prisma.taskRun.update({
67-
where: {
68-
id: taskRun.id,
69-
},
70-
data: {
71-
status: "CRASHED",
72-
completedAt: new Date(),
73-
},
63+
const finalizeService = new FinalizeTaskRunService();
64+
const crashedTaskRun = await finalizeService.call({
65+
tx: this._prisma,
66+
id: taskRun.id,
67+
status: "CRASHED",
68+
completedAt: new Date(),
7469
include: {
7570
attempts: {
7671
where: {

0 commit comments

Comments
 (0)