Skip to content

Commit 00fb2e5

Browse files
committed
fix(engine): key by the queue ID or the env/queue name instead of the run ID
1 parent fe5178f commit 00fb2e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ export class RunAttemptSystem {
237237
filePath: "unknown",
238238
}),
239239
this.#resolveTaskRunExecutionQueue({
240-
runId,
241240
lockedQueueId: run.lockedQueueId ?? undefined,
242241
queueName: run.queue,
243242
runtimeEnvironmentId: run.runtimeEnvironment.id,
@@ -538,7 +537,6 @@ export class RunAttemptSystem {
538537
}),
539538
this.#resolveTaskRunExecutionTask(taskRun.lockedById),
540539
this.#resolveTaskRunExecutionQueue({
541-
runId,
542540
lockedQueueId: updatedRun.lockedQueueId ?? undefined,
543541
queueName: updatedRun.queue,
544542
runtimeEnvironmentId: updatedRun.runtimeEnvironment.id,
@@ -1868,12 +1866,14 @@ export class RunAttemptSystem {
18681866
}
18691867

18701868
async #resolveTaskRunExecutionQueue(params: {
1871-
runId: string;
18721869
lockedQueueId?: string;
18731870
queueName: string;
18741871
runtimeEnvironmentId: string;
18751872
}): Promise<TaskRunExecutionQueue> {
1876-
const result = await this.cache.queues.swr(params.runId, async () => {
1873+
// Cache key should be based on queue identity, not run ID
1874+
// Using lockedQueueId if available, otherwise environment + queue name
1875+
const cacheKey = params.lockedQueueId ?? `${params.runtimeEnvironmentId}:${params.queueName}`;
1876+
const result = await this.cache.queues.swr(cacheKey, async () => {
18771877
const queue = params.lockedQueueId
18781878
? await this.$.readOnlyPrisma.taskQueue.findFirst({
18791879
where: {

0 commit comments

Comments
 (0)