From 5dfdc1d81dceea5fceb01d841a9f4bcb9e5e41d3 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Mon, 16 Mar 2026 15:10:38 +0100 Subject: [PATCH] refactor: consolidate database query timeout config variables (#18670) ## Summary - Removes the redundant `DATABASE_STATEMENT_TIMEOUT_MS` config variable (default 15s) from `ConfigVariables` - Updates the core TypeORM datasource to use `PG_DATABASE_PRIMARY_TIMEOUT_MS` (default 10s) for its `query_timeout`, aligning it with the workspace datasource which already uses this variable - This consolidates two separate env vars that controlled the same concern (database query timeout) into a single one --- .../src/database/typeorm/core/core.datasource.ts | 2 +- .../core-modules/twenty-config/config-variables.ts | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/twenty-server/src/database/typeorm/core/core.datasource.ts b/packages/twenty-server/src/database/typeorm/core/core.datasource.ts index 597a786ddab..41413364cf7 100644 --- a/packages/twenty-server/src/database/typeorm/core/core.datasource.ts +++ b/packages/twenty-server/src/database/typeorm/core/core.datasource.ts @@ -72,7 +72,7 @@ export const typeORMCoreModuleOptions: TypeOrmModuleOptions = { } : undefined, extra: { - query_timeout: Number(process.env.DATABASE_STATEMENT_TIMEOUT_MS ?? 15000), + query_timeout: Number(process.env.PG_DATABASE_PRIMARY_TIMEOUT_MS ?? 10000), }, }; diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts index 1210d0f874d..e7ce5afd024 100644 --- a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts +++ b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts @@ -1682,17 +1682,6 @@ export class ConfigVariables { @IsOptional() PG_DATABASE_REPLICA_TIMEOUT_MS: number = 10000; - @ConfigVariablesMetadata({ - group: ConfigVariablesGroup.SERVER_CONFIG, - description: - 'Client-side query timeout in milliseconds for the core database connection pool. Controls how long any single query can run before the driver aborts it.', - type: ConfigVariableType.NUMBER, - isEnvOnly: true, - }) - @CastToPositiveNumber() - @IsOptional() - DATABASE_STATEMENT_TIMEOUT_MS: number = 15000; - @ConfigVariablesMetadata({ group: ConfigVariablesGroup.SERVER_CONFIG, description: