From 9eafa251643cd5d25a56fedf1de95dcab50d60ba Mon Sep 17 00:00:00 2001 From: Brad Harris Date: Wed, 4 Oct 2023 17:00:11 +0000 Subject: [PATCH] wrap recent repos w/ repo search flag check --- .../bitbucket-server-repository-provider.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/server/src/bitbucket-server/bitbucket-server-repository-provider.ts b/components/server/src/bitbucket-server/bitbucket-server-repository-provider.ts index f1028644ae337e..b517cfa307c2fc 100644 --- a/components/server/src/bitbucket-server/bitbucket-server-repository-provider.ts +++ b/components/server/src/bitbucket-server/bitbucket-server-repository-provider.ts @@ -10,6 +10,7 @@ import { RepoURL } from "../repohost"; import { RepositoryProvider } from "../repohost/repository-provider"; import { BitbucketServerApi } from "./bitbucket-server-api"; import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; +import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server"; @injectable() export class BitbucketServerRepositoryProvider implements RepositoryProvider { @@ -145,8 +146,20 @@ export class BitbucketServerRepositoryProvider implements RepositoryProvider { } async getUserRepos(user: User): Promise { + const repoSearchEnabled = await getExperimentsClientForBackend().getValueAsync( + "repositoryFinderSearch", + false, + { + user, + }, + ); + try { - const repos = await this.api.getRecentRepos(user, { limit: 25 }); + const repos = repoSearchEnabled + ? // Get up to 100 of the most recent repos if repo searching is enabled + await this.api.getRecentRepos(user, { limit: 100 }) + : // Otherwise continue to get up to 10k repos + await this.api.getRepos(user, { maxPages: 10, permission: "REPO_READ" }); const result: RepositoryInfo[] = []; repos.forEach((r) => {