From a4ad08396cea3f2e6f9e3f1f23a33ec0f187b60f Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Mon, 23 Aug 2021 12:36:23 +0000 Subject: [PATCH] [projects] limit number of prebuilts --- components/gitpod-protocol/src/gitpod-service.ts | 2 ++ components/server/src/projects/projects-service.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/gitpod-protocol/src/gitpod-service.ts b/components/gitpod-protocol/src/gitpod-service.ts index dd557d56771973..6eec038ce865a3 100644 --- a/components/gitpod-protocol/src/gitpod-service.ts +++ b/components/gitpod-protocol/src/gitpod-service.ts @@ -239,6 +239,8 @@ export interface FindPrebuildsParams { branch?: string; latest?: boolean; prebuildId?: string; + // default: 30 + limit?: number; } export interface GetProviderRepositoriesParams { provider: string; diff --git a/components/server/src/projects/projects-service.ts b/components/server/src/projects/projects-service.ts index f3996a04391cac..611abf7104e65c 100644 --- a/components/server/src/projects/projects-service.ts +++ b/components/server/src/projects/projects-service.ts @@ -159,7 +159,10 @@ export class ProjectsService { prebuilds.push(pbws); } } else { - const limit = params.latest ? 1 : undefined; + let limit = params.limit !== undefined ? params.limit : 30; + if (params.latest) { + limit = 1; + } let branch = params.branch; prebuilds = await this.workspaceDb.trace({}).findPrebuiltWorkspacesByProject(project.id, branch, limit); }