File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const PG_META_DB_PASSWORD = (await getSecret('PG_META_DB_PASSWORD')) || 'postgre
1616const PG_META_DB_SSL_MODE = process . env . PG_META_DB_SSL_MODE || 'disable'
1717
1818const PG_CONN_TIMEOUT_SECS = Number ( process . env . PG_CONN_TIMEOUT_SECS || 15 )
19+ const PG_QUERY_TIMEOUT_SECS = Number ( process . env . PG_QUERY_TIMEOUT_SECS || 55 )
1920
2021export let PG_CONNECTION = process . env . PG_META_DB_URL
2122if ( ! PG_CONNECTION ) {
@@ -58,6 +59,7 @@ export const PG_META_MAX_RESULT_SIZE = process.env.PG_META_MAX_RESULT_SIZE_MB
5859export const DEFAULT_POOL_CONFIG : PoolConfig = {
5960 max : 1 ,
6061 connectionTimeoutMillis : PG_CONN_TIMEOUT_SECS * 1000 ,
62+ query_timeout : PG_QUERY_TIMEOUT_SECS * 1000 ,
6163 ssl : PG_META_DB_SSL_ROOT_CERT ? { ca : PG_META_DB_SSL_ROOT_CERT } : undefined ,
6264 application_name : `postgres-meta ${ pkg . version } ` ,
6365 maxResultSize : PG_META_MAX_RESULT_SIZE ,
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ export function translateErrorToResponseCode(
2929 return 504
3030 } else if ( error . message === 'sorry, too many clients already' ) {
3131 return 503
32+ } else if ( error . message === 'Query read timeout' ) {
33+ return 408
3234 }
3335 return defaultResponseCode
3436}
You can’t perform that action at this time.
0 commit comments