Skip to content

Commit 67d74f0

Browse files
committed
More tests passing, fixed the heartbeat issue
1 parent 7866e95 commit 67d74f0

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
@@ -1331,6 +1331,20 @@ export class RunEngine {
13311331
}
13321332

13331333
//it will automatically be requeued X times depending on the queue retry settings
1334+
await this.runAttemptSystem.tryNackAndRequeue({
1335+
run,
1336+
environment: {
1337+
id: latestSnapshot.environmentId,
1338+
type: latestSnapshot.environmentType,
1339+
},
1340+
orgId: run.runtimeEnvironment.organizationId,
1341+
error: {
1342+
type: "INTERNAL_ERROR",
1343+
code: "TASK_RUN_DEQUEUED_MAX_RETRIES",
1344+
message: `Trying to create an attempt failed multiple times, exceeding how many times we retry.`,
1345+
},
1346+
tx: prisma,
1347+
});
13341348
break;
13351349
}
13361350
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
@@ -473,7 +473,8 @@ export class RunQueue {
473473
const message = await this.readMessage(orgId, messageId);
474474

475475
if (!message) {
476-
throw new MessageNotFoundError(messageId);
476+
// Message not found, it may have already been acknowledged
477+
return;
477478
}
478479

479480
span.setAttributes({

0 commit comments

Comments
 (0)