Skip to content

Commit 32b89a2

Browse files
committed
Removed old wait code from the run controllers/task run process
1 parent 3db4a29 commit 32b89a2

File tree

3 files changed

+2
-83
lines changed

3 files changed

+2
-83
lines changed

packages/cli-v3/src/entryPoints/dev-run-controller.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { type WorkloadRunAttemptStartResponseBody } from "@trigger.dev/core/v3/workers";
1212
import { setTimeout as sleep } from "timers/promises";
1313
import { CliApiClient } from "../apiClient.js";
14-
import { OnWaitMessage, TaskRunProcess } from "../executions/taskRunProcess.js";
14+
import { TaskRunProcess } from "../executions/taskRunProcess.js";
1515
import { assertExhaustive } from "../utilities/assertExhaustive.js";
1616
import { logger } from "../utilities/logger.js";
1717
import { sanitizeEnvVars } from "../utilities/sanitizeEnvVars.js";
@@ -598,8 +598,6 @@ export class DevRunController {
598598
messageId: run.friendlyId,
599599
});
600600

601-
this.taskRunProcess.onWait.attach(this.handleWait.bind(this));
602-
603601
await this.taskRunProcess.initialize();
604602

605603
logger.debug("executing task run process", {
@@ -729,41 +727,6 @@ export class DevRunController {
729727
assertExhaustive(attemptStatus);
730728
}
731729

732-
private async handleWait({ wait }: OnWaitMessage) {
733-
if (!this.runFriendlyId || !this.snapshotFriendlyId) {
734-
logger.debug("[DevRunController] Ignoring wait, no run ID or snapshot ID");
735-
return;
736-
}
737-
738-
switch (wait.type) {
739-
case "DATETIME": {
740-
logger.debug("Waiting for duration", { wait });
741-
742-
const waitpoint = await this.httpClient.dev.waitForDuration(
743-
this.runFriendlyId,
744-
this.snapshotFriendlyId,
745-
{
746-
date: wait.date,
747-
}
748-
);
749-
750-
if (!waitpoint.success) {
751-
logger.debug("Failed to wait for datetime", { error: waitpoint.error });
752-
return;
753-
}
754-
755-
logger.debug("Waitpoint created", { waitpointData: waitpoint.data });
756-
757-
this.taskRunProcess?.waitpointCreated(wait.id, waitpoint.data.waitpoint.id);
758-
759-
break;
760-
}
761-
default: {
762-
logger.debug("Wait type not implemented", { wait });
763-
}
764-
}
765-
}
766-
767730
private async runFinished() {
768731
// Kill the run process
769732
try {

packages/cli-v3/src/entryPoints/managed-run-controller.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { logger } from "../utilities/logger.js";
2-
import { OnWaitMessage, TaskRunProcess } from "../executions/taskRunProcess.js";
2+
import { TaskRunProcess } from "../executions/taskRunProcess.js";
33
import { env as stdEnv } from "std-env";
44
import { z } from "zod";
55
import { randomUUID } from "crypto";
@@ -832,8 +832,6 @@ class ManagedRunController {
832832
messageId: run.friendlyId,
833833
});
834834

835-
this.taskRunProcess.onWait.attach(this.handleWait.bind(this));
836-
837835
await this.taskRunProcess.initialize();
838836

839837
logger.log("executing task run process", {
@@ -953,41 +951,6 @@ class ManagedRunController {
953951
assertExhaustive(attemptStatus);
954952
}
955953

956-
private async handleWait({ wait }: OnWaitMessage) {
957-
if (!this.runFriendlyId || !this.snapshotFriendlyId) {
958-
logger.debug("[ManagedRunController] Ignoring wait, no run ID or snapshot ID");
959-
return;
960-
}
961-
962-
switch (wait.type) {
963-
case "DATETIME": {
964-
logger.log("Waiting for duration", { wait });
965-
966-
const waitpoint = await this.httpClient.waitForDuration(
967-
this.runFriendlyId,
968-
this.snapshotFriendlyId,
969-
{
970-
date: wait.date,
971-
}
972-
);
973-
974-
if (!waitpoint.success) {
975-
console.error("Failed to wait for datetime", { error: waitpoint.error });
976-
return;
977-
}
978-
979-
logger.log("Waitpoint created", { waitpointData: waitpoint.data });
980-
981-
this.taskRunProcess?.waitpointCreated(wait.id, waitpoint.data.waitpoint.id);
982-
983-
break;
984-
}
985-
default: {
986-
console.error("Wait type not implemented", { wait });
987-
}
988-
}
989-
}
990-
991954
async cancelAttempt(runId: string) {
992955
logger.log("cancelling attempt", { runId });
993956

packages/cli-v3/src/executions/taskRunProcess.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class TaskRunProcess {
7474
public onIsBeingKilled: Evt<TaskRunProcess> = new Evt();
7575
public onReadyToDispose: Evt<TaskRunProcess> = new Evt();
7676

77-
public onWaitForDuration: Evt<OnWaitForDurationMessage> = new Evt();
7877
public onWaitForTask: Evt<OnWaitForTaskMessage> = new Evt();
7978
public onWaitForBatch: Evt<OnWaitForBatchMessage> = new Evt();
8079
public onWait: Evt<OnWaitMessage> = new Evt();
@@ -186,15 +185,9 @@ export class TaskRunProcess {
186185
WAIT_FOR_BATCH: async (message) => {
187186
this.onWaitForBatch.post(message);
188187
},
189-
WAIT_FOR_DURATION: async (message) => {
190-
this.onWaitForDuration.post(message);
191-
},
192188
UNCAUGHT_EXCEPTION: async (message) => {
193189
logger.debug(`[${this.runId}] uncaught exception in task run process`, { ...message });
194190
},
195-
WAIT: async (message) => {
196-
this.onWait.post(message);
197-
},
198191
},
199192
});
200193

0 commit comments

Comments
 (0)