Skip to content

Commit eef3626

Browse files
committed
set run status back to PENDING when we requeue
1 parent fa300d2 commit eef3626

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ export class RunAttemptSystem {
11361136
const prisma = tx ?? this.$.prisma;
11371137

11381138
return await this.$.runLock.lock("tryNackAndRequeue", [run.id], async () => {
1139-
//we nack the message, this allows another work to pick up the run
1139+
//we nack the message, this allows another worker to pick up the run
11401140
const gotRequeued = await this.$.runQueue.nackMessage({
11411141
orgId,
11421142
messageId: run.id,
@@ -1152,8 +1152,22 @@ export class RunAttemptSystem {
11521152
return { wasRequeued: false, ...result };
11531153
}
11541154

1155+
const requeuedRun = await prisma.taskRun.update({
1156+
where: {
1157+
id: run.id,
1158+
},
1159+
data: {
1160+
status: "PENDING",
1161+
},
1162+
select: {
1163+
id: true,
1164+
status: true,
1165+
attemptNumber: true,
1166+
},
1167+
});
1168+
11551169
const newSnapshot = await this.executionSnapshotSystem.createExecutionSnapshot(prisma, {
1156-
run: run,
1170+
run: requeuedRun,
11571171
snapshot: {
11581172
executionStatus: "QUEUED",
11591173
description: "Requeued the run after a failure",

0 commit comments

Comments
 (0)