Skip to content

Commit ff157e5

Browse files
authored
If the run is already PENDING_EXECUTING, log an error and ack but don’t fail the run (#2129)
1 parent a027e6a commit ff157e5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ export class DequeueSystem {
9999
const snapshot = await getLatestExecutionSnapshot(prisma, runId);
100100

101101
if (!isDequeueableExecutionStatus(snapshot.executionStatus)) {
102+
// If it's pending executing it will be picked up by the stalled system if there's an issue
103+
if (snapshot.executionStatus === "PENDING_EXECUTING") {
104+
this.$.logger.error(
105+
"RunEngine.dequeueFromMasterQueue(): Run is already PENDING_EXECUTING, removing from queue",
106+
{
107+
runId,
108+
orgId,
109+
}
110+
);
111+
// remove the run from the queue
112+
await this.$.runQueue.acknowledgeMessage(orgId, runId);
113+
return null;
114+
}
115+
102116
//create a failed snapshot
103117
await this.executionSnapshotSystem.createExecutionSnapshot(prisma, {
104118
run: {

0 commit comments

Comments
 (0)