mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-14 21:35:25 +00:00
add connection manager upsert timeout env var
This commit is contained in:
parent
a1b5d98f22
commit
691c5937c1
2 changed files with 4 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import { Redis } from 'ioredis';
|
||||||
import { RepoData, compileGithubConfig, compileGitlabConfig, compileGiteaConfig, compileGerritConfig } from "./repoCompileUtils.js";
|
import { RepoData, compileGithubConfig, compileGitlabConfig, compileGiteaConfig, compileGerritConfig } from "./repoCompileUtils.js";
|
||||||
import { BackendError, BackendException } from "@sourcebot/error";
|
import { BackendError, BackendException } from "@sourcebot/error";
|
||||||
import { captureEvent } from "./posthog.js";
|
import { captureEvent } from "./posthog.js";
|
||||||
|
import { env } from "./env.js";
|
||||||
import * as Sentry from "@sentry/node";
|
import * as Sentry from "@sentry/node";
|
||||||
|
|
||||||
interface IConnectionManager {
|
interface IConnectionManager {
|
||||||
|
|
@ -220,7 +221,7 @@ export class ConnectionManager implements IConnectionManager {
|
||||||
}
|
}
|
||||||
const totalUpsertDuration = performance.now() - totalUpsertStart;
|
const totalUpsertDuration = performance.now() - totalUpsertStart;
|
||||||
this.logger.info(`Upserted ${repoData.length} repos in ${totalUpsertDuration}ms`);
|
this.logger.info(`Upserted ${repoData.length} repos in ${totalUpsertDuration}ms`);
|
||||||
});
|
}, { timeout: env.CONNECTION_MANAGER_UPSERT_TIMEOUT_MS });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
repoCount: repoData.length,
|
repoCount: repoData.length,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ export const env = createEnv({
|
||||||
|
|
||||||
DATABASE_URL: z.string().url().default("postgresql://postgres:postgres@localhost:5432/postgres"),
|
DATABASE_URL: z.string().url().default("postgresql://postgres:postgres@localhost:5432/postgres"),
|
||||||
CONFIG_PATH: z.string().optional(),
|
CONFIG_PATH: z.string().optional(),
|
||||||
|
|
||||||
|
CONNECTION_MANAGER_UPSERT_TIMEOUT_MS: numberSchema.default(10000),
|
||||||
},
|
},
|
||||||
runtimeEnv: process.env,
|
runtimeEnv: process.env,
|
||||||
emptyStringAsUndefined: true,
|
emptyStringAsUndefined: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue