File tree 2 files changed +4
-0
lines changed
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
16
16
const PG_META_DB_SSL_MODE = process . env . PG_META_DB_SSL_MODE || 'disable'
17
17
18
18
const 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 )
19
20
20
21
export let PG_CONNECTION = process . env . PG_META_DB_URL
21
22
if ( ! PG_CONNECTION ) {
@@ -58,6 +59,7 @@ export const PG_META_MAX_RESULT_SIZE = process.env.PG_META_MAX_RESULT_SIZE_MB
58
59
export const DEFAULT_POOL_CONFIG : PoolConfig = {
59
60
max : 1 ,
60
61
connectionTimeoutMillis : PG_CONN_TIMEOUT_SECS * 1000 ,
62
+ query_timeout : PG_QUERY_TIMEOUT_SECS * 1000 ,
61
63
ssl : PG_META_DB_SSL_ROOT_CERT ? { ca : PG_META_DB_SSL_ROOT_CERT } : undefined ,
62
64
application_name : `postgres-meta ${ pkg . version } ` ,
63
65
maxResultSize : PG_META_MAX_RESULT_SIZE ,
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ export function translateErrorToResponseCode(
29
29
return 504
30
30
} else if ( error . message === 'sorry, too many clients already' ) {
31
31
return 503
32
+ } else if ( error . message === 'Query read timeout' ) {
33
+ return 408
32
34
}
33
35
return defaultResponseCode
34
36
}
You can’t perform that action at this time.
0 commit comments