add connection manager upsert timeout env var

This commit is contained in:
msukkari 2025-03-25 18:17:39 -07:00
parent a1b5d98f22
commit 691c5937c1
2 changed files with 4 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import { Redis } from 'ioredis';
import { RepoData, compileGithubConfig, compileGitlabConfig, compileGiteaConfig, compileGerritConfig } from "./repoCompileUtils.js";
import { BackendError, BackendException } from "@sourcebot/error";
import { captureEvent } from "./posthog.js";
import { env } from "./env.js";
import * as Sentry from "@sentry/node";
interface IConnectionManager {
@ -220,7 +221,7 @@ export class ConnectionManager implements IConnectionManager {
}
const totalUpsertDuration = performance.now() - totalUpsertStart;
this.logger.info(`Upserted ${repoData.length} repos in ${totalUpsertDuration}ms`);
});
}, { timeout: env.CONNECTION_MANAGER_UPSERT_TIMEOUT_MS });
return {
repoCount: repoData.length,

View file

@ -43,6 +43,8 @@ export const env = createEnv({
DATABASE_URL: z.string().url().default("postgresql://postgres:postgres@localhost:5432/postgres"),
CONFIG_PATH: z.string().optional(),
CONNECTION_MANAGER_UPSERT_TIMEOUT_MS: numberSchema.default(10000),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,