Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/skip-waiting-for-deploy-on-v2-promotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: fix
---

Skip the legacy V1 `WAITING_FOR_DEPLOY` drain on V2 deployment promotions. A new `LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_DISABLED` env var also acts as a kill-switch for any already-enqueued jobs.
1 change: 1 addition & 0 deletions apps/webapp/app/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,7 @@ const EnvironmentSchema = z

LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_SIZE: z.coerce.number().int().default(100),
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_STAGGER_MS: z.coerce.number().int().default(1_000),
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_DISABLED: z.string().default("0"),

COMMON_WORKER_ENABLED: z.string().default(process.env.WORKER_ENABLED ?? "true"),
COMMON_WORKER_CONCURRENCY_WORKERS: z.coerce.number().int().default(2),
Expand Down
12 changes: 11 additions & 1 deletion apps/webapp/app/v3/services/changeCurrentDeployment.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,17 @@ export class ChangeCurrentDeploymentService extends BaseService {
});
}

await ExecuteTasksWaitingForDeployService.enqueue(deployment.workerId);
// Only V1 engine workers need the WAITING_FOR_DEPLOY drain — V2 runs sit
// in PENDING_VERSION and are handled out of band, so enqueuing here for V2
// just produces empty scans of the TaskRun status index.
const worker = await this._prisma.backgroundWorker.findFirst({
where: { id: deployment.workerId },
select: { engine: true },
});

if (worker?.engine === "V1") {
await ExecuteTasksWaitingForDeployService.enqueue(deployment.workerId);
}
}

async #syncSchedulesForDeployment(deployment: WorkerDeployment) {
Expand Down
6 changes: 6 additions & 0 deletions apps/webapp/app/v3/services/executeTasksWaitingForDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { BaseService } from "./baseService.server";

export class ExecuteTasksWaitingForDeployService extends BaseService {
public async call(backgroundWorkerId: string) {
// Kill-switch for the legacy V1 WAITING_FOR_DEPLOY drain. Set to "1" to
// neuter any jobs already enqueued (V2 has its own PENDING_VERSION path).
if (env.LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_DISABLED === "1") {
return;
}

const backgroundWorker = await this._prisma.backgroundWorker.findFirst({
where: {
id: backgroundWorkerId,
Expand Down