Skip to content

Commit 813a973

Browse files
refactor: use plain cuid via generateInternalId instead of SnapshotId.generate()
Co-Authored-By: Eric Allam <eallam@icloud.com>
1 parent 3c67415 commit 813a973

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { startSpan } from "@internal/tracing";
33
import { assertExhaustive, tryCatch } from "@trigger.dev/core";
44
import { DequeuedMessage, RetryOptions, RunAnnotations } from "@trigger.dev/core/v3";
55
import { placementTag } from "@trigger.dev/core/v3/serverOnly";
6-
import { getMaxDuration, SnapshotId } from "@trigger.dev/core/v3/isomorphic";
6+
import { generateInternalId, getMaxDuration, SnapshotId } from "@trigger.dev/core/v3/isomorphic";
77
import {
88
BackgroundWorker,
99
BackgroundWorkerTask,
@@ -417,7 +417,7 @@ export class DequeueSystem {
417417
: result.task.retryConfig;
418418

419419
// Pre-generate snapshot ID so we can construct the result without an extra read
420-
const snapshotIds = SnapshotId.generate();
420+
const snapshotId = generateInternalId();
421421

422422
const lockedTaskRun = await prisma.taskRun.update({
423423
where: {
@@ -440,7 +440,7 @@ export class DequeueSystem {
440440
maxAttempts: maxAttempts ?? undefined,
441441
executionSnapshots: {
442442
create: {
443-
id: snapshotIds.id,
443+
id: snapshotId,
444444
engine: "V2",
445445
executionStatus: "PENDING_EXECUTING",
446446
description: "Run was dequeued for execution",
@@ -557,7 +557,7 @@ export class DequeueSystem {
557557
id: runId,
558558
},
559559
snapshot: {
560-
id: snapshotIds.id,
560+
id: snapshotId,
561561
executionStatus: "PENDING_EXECUTING",
562562
description: "Run was dequeued for execution",
563563
runStatus: "PENDING",
@@ -572,7 +572,7 @@ export class DequeueSystem {
572572
});
573573

574574
await this.executionSnapshotSystem.enqueueHeartbeatIfNeeded({
575-
id: snapshotIds.id,
575+
id: snapshotId,
576576
runId,
577577
executionStatus: "PENDING_EXECUTING",
578578
});
@@ -582,8 +582,8 @@ export class DequeueSystem {
582582
dequeuedAt: new Date(),
583583
workerQueueLength: message.workerQueueLength,
584584
snapshot: {
585-
id: snapshotIds.id,
586-
friendlyId: snapshotIds.friendlyId,
585+
id: snapshotId,
586+
friendlyId: SnapshotId.toFriendlyId(snapshotId),
587587
executionStatus: "PENDING_EXECUTING" as const,
588588
description: "Run was dequeued for execution",
589589
createdAt: snapshotCreatedAt,

0 commit comments

Comments
 (0)