Skip to content

Commit 4b9f2fb

Browse files
committed
feat: default connection timeout of 15 seconds
By default there is no timeout, which results in fairly unhelpful messages from other components in the stack because they do have limits of e.g. 60s
1 parent 9da6ae6 commit 4b9f2fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/server/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ const PG_META_DB_USER = process.env.PG_META_DB_USER || 'postgres'
77
const PG_META_DB_PORT = Number(process.env.PG_META_DB_PORT) || 5432
88
const PG_META_DB_PASSWORD = process.env.PG_META_DB_PASSWORD || 'postgres'
99

10+
const PG_CONN_TIMEOUT_SECS = Number(process.env.PG_CONN_TIMEOUT_SECS || 15)
11+
1012
export const PG_CONNECTION = `postgres://${PG_META_DB_USER}:${PG_META_DB_PASSWORD}@${PG_META_DB_HOST}:${PG_META_DB_PORT}/${PG_META_DB_NAME}?sslmode=disable`
1113

1214
export const PG_META_EXPORT_DOCS = process.env.PG_META_EXPORT_DOCS === 'true' || false
1315

14-
export const DEFAULT_POOL_CONFIG = { max: 1 }
16+
export const DEFAULT_POOL_CONFIG = { max: 1, connectionTimeoutMillis: PG_CONN_TIMEOUT_SECS * 1000 }

0 commit comments

Comments
 (0)