Skip to content

Commit 74692a2

Browse files
committed
Changed the worker deployment queries to only select what they need, some of the columns are huge
1 parent c95c68c commit 74692a2

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

apps/webapp/app/v3/models/workerDeployment.server.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ export type CurrentWorkerDeployment = Prettify<
99
>;
1010

1111
type WorkerDeploymentWithWorkerTasks = Prisma.WorkerDeploymentGetPayload<{
12-
include: {
12+
select: {
13+
id: true;
14+
imageReference: true;
15+
version: true;
1316
worker: {
14-
include: {
17+
select: {
18+
id: true;
19+
friendlyId: true;
20+
version: true;
21+
sdkVersion: true;
22+
cliVersion: true;
23+
supportsLazyAttempts: true;
1524
tasks: true;
1625
};
1726
};
@@ -26,11 +35,20 @@ export async function findCurrentWorkerDeployment(
2635
environmentId,
2736
label: CURRENT_DEPLOYMENT_LABEL,
2837
},
29-
include: {
38+
select: {
3039
deployment: {
31-
include: {
40+
select: {
41+
id: true,
42+
imageReference: true,
43+
version: true,
3244
worker: {
33-
include: {
45+
select: {
46+
id: true,
47+
friendlyId: true,
48+
version: true,
49+
sdkVersion: true,
50+
cliVersion: true,
51+
supportsLazyAttempts: true,
3452
tasks: true,
3553
},
3654
},
@@ -44,7 +62,10 @@ export async function findCurrentWorkerDeployment(
4462

4563
export async function findCurrentWorkerFromEnvironment(
4664
environment: Pick<AuthenticatedEnvironment, "id" | "type">
47-
): Promise<BackgroundWorker | null> {
65+
): Promise<Pick<
66+
BackgroundWorker,
67+
"id" | "friendlyId" | "version" | "sdkVersion" | "cliVersion" | "supportsLazyAttempts"
68+
> | null> {
4869
if (environment.type === "DEVELOPMENT") {
4970
const latestDevWorker = await prisma.backgroundWorker.findFirst({
5071
where: {

0 commit comments

Comments
 (0)