增加数据库慢查询观测与索引防线并收窄打手拼单分页查询

This commit is contained in:
yml2213
2026-08-22 18:40:11 +08:00
parent 0dfe363d35
commit 1b8e02dd17
16 changed files with 221 additions and 7 deletions
+1
View File
@@ -26,6 +26,7 @@ export function createDefaultRuntimeConfig(projectRoot: string): RuntimeConfig {
idleTimeoutMs: 30_000,
connectionTimeoutMs: 5_000,
statementTimeoutMs: 15_000,
slowQueryThresholdMs: 500,
},
storage: {
@@ -24,6 +24,7 @@ const DEPLOYMENT_ONLY_ENV_NAMES = [
'MINIO_ROOT_USER',
'NPM_CONFIG_REGISTRY',
'POSTGRES_DB',
'POSTGRES_LOG_MIN_DURATION_STATEMENT_MS',
'POSTGRES_PASSWORD',
'POSTGRES_PORT',
'POSTGRES_USER',
+1
View File
@@ -38,6 +38,7 @@ export const ENV_OVERRIDES: readonly EnvOverride[] = [
integerEnv('DATABASE_IDLE_TIMEOUT_MS', ['database', 'idleTimeoutMs']),
integerEnv('DATABASE_CONNECTION_TIMEOUT_MS', ['database', 'connectionTimeoutMs']),
integerEnv('DATABASE_STATEMENT_TIMEOUT_MS', ['database', 'statementTimeoutMs']),
integerEnv('DATABASE_SLOW_QUERY_THRESHOLD_MS', ['database', 'slowQueryThresholdMs']),
stringEnv('STORAGE_ENDPOINT', ['storage', 'endpoint']),
stringEnv('STORAGE_BUCKET', ['storage', 'bucket']),
stringEnv('STORAGE_ACCESS_KEY_ID', ['storage', 'accessKeyId']),
@@ -62,6 +62,12 @@ export function validateRuntimeConfig(
min: 1,
},
)
requireOptionalInteger(
issues,
'database.slowQueryThresholdMs',
config.database?.slowQueryThresholdMs,
{ min: 0 },
)
requireInteger(issues, 'storage.maxUploadSizeMb', config.storage?.maxUploadSizeMb, {
min: 1,
max: 100,