Skip to content

Commit 9b2f012

Browse files
committed
More tests passing, fixed the heartbeat issue
1 parent ebf0b6b commit 9b2f012

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

internal-packages/run-engine/src/engine/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,20 @@ export class RunEngine {
13191319
}
13201320

13211321
//it will automatically be requeued X times depending on the queue retry settings
1322+
await this.runAttemptSystem.tryNackAndRequeue({
1323+
run,
1324+
environment: {
1325+
id: latestSnapshot.environmentId,
1326+
type: latestSnapshot.environmentType,
1327+
},
1328+
orgId: run.runtimeEnvironment.organizationId,
1329+
error: {
1330+
type: "INTERNAL_ERROR",
1331+
code: "TASK_RUN_DEQUEUED_MAX_RETRIES",
1332+
message: `Trying to create an attempt failed multiple times, exceeding how many times we retry.`,
1333+
},
1334+
tx: prisma,
1335+
});
13221336
break;
13231337
}
13241338
case "EXECUTING":

internal-packages/run-engine/src/engine/tests/heartbeats.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe("RunEngine heartbeats", () => {
9595
assertNonNullable(executionData);
9696
expect(executionData.snapshot.executionStatus).toBe("PENDING_EXECUTING");
9797

98-
await setTimeout(pendingExecutingTimeout * 2);
98+
await setTimeout(pendingExecutingTimeout * 4);
9999

100100
//expect it to be pending with 3 consecutiveFailures
101101
const executionData2 = await engine.getRunExecutionData({ runId: run.id });

internal-packages/run-engine/src/engine/tests/locking.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createRedisClient } from "@internal/redis";
22
import { redisTest } from "@internal/testcontainers";
33
import { expect } from "vitest";
4-
import { RunLocker } from "./locking.js";
4+
import { RunLocker } from "../locking.js";
55

66
describe("RunLocker", () => {
77
redisTest("Test acquiring a lock works", { timeout: 15_000 }, async ({ redisOptions }) => {

internal-packages/run-engine/src/engine/tests/triggerAndWait.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ describe("RunEngine triggerAndWait", () => {
372372
const blockedResult = await engine.blockRunWithWaitpoint({
373373
runId: parentRun2.id,
374374
waitpoints: childRunWithWaitpoint.associatedWaitpoint!.id,
375-
environmentId: authenticatedEnvironment.id,
376375
projectId: authenticatedEnvironment.project.id,
377376
organizationId: authenticatedEnvironment.organizationId,
378377
tx: prisma,

internal-packages/run-engine/src/run-queue/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,8 @@ export class RunQueue {
403403
const message = await this.readMessage(orgId, messageId);
404404

405405
if (!message) {
406-
throw new MessageNotFoundError(messageId);
406+
// Message not found, it may have already been acknowledged
407+
return;
407408
}
408409

409410
span.setAttributes({

0 commit comments

Comments
 (0)