From dd78dd92eece748023ed5bc488f7dabe0a2a58d7 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Fri, 14 Aug 2026 16:12:50 +0100 Subject: [PATCH] perf(webapp): select only needed columns in dev current-worker lookup (#4621) ## Summary When resolving the current worker for a development environment, `findCurrentWorkerFromEnvironment` loaded the entire `BackgroundWorker` row, including the large `metadata` JSON, even though it only ever returns a handful of small fields. It is a frequently-run query, so the wasted payload adds up: every call pulled data it immediately threw away. ## Fix Add a `select` to the development-environment lookup listing exactly the fields the function returns (`id`, `friendlyId`, `version`, `sdkVersion`, `cliVersion`, `supportsLazyAttempts`, `engine`). The query plan is unchanged, still a single-row indexed lookup; only the row width shrinks. No behavior change: the dropped columns were never read. --- apps/webapp/app/v3/models/workerDeployment.server.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/webapp/app/v3/models/workerDeployment.server.ts b/apps/webapp/app/v3/models/workerDeployment.server.ts index 48995bf2b..56f880f7b 100644 --- a/apps/webapp/app/v3/models/workerDeployment.server.ts +++ b/apps/webapp/app/v3/models/workerDeployment.server.ts @@ -209,6 +209,15 @@ export async function findCurrentWorkerFromEnvironment( where: { runtimeEnvironmentId: environment.id, }, + select: { + id: true, + friendlyId: true, + version: true, + sdkVersion: true, + cliVersion: true, + supportsLazyAttempts: true, + engine: true, + }, orderBy: { createdAt: "desc", },