File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,18 @@ import { app } from './utils'
33import { pgMeta } from '../lib/utils'
44
55const TIMEOUT = ( Number ( process . env . PG_QUERY_TIMEOUT_SECS ) ?? 10 ) + 2
6+ const STATEMENT_TIMEOUT = ( Number ( process . env . PG_QUERY_TIMEOUT_SECS ) ?? 10 ) + 1
67
78describe ( 'test query timeout' , ( ) => {
89 test (
910 `query timeout after ${ TIMEOUT } s and connection cleanup` ,
1011 async ( ) => {
11- const query = `SELECT pg_sleep(${ TIMEOUT } );`
12+ const query = `SELECT pg_sleep(${ TIMEOUT + 10 } );`
1213 // Execute a query that will sleep for 10 seconds
1314 const res = await app . inject ( {
1415 method : 'POST' ,
1516 path : '/query' ,
16- query : `statementTimeoutSecs=${ TIMEOUT - 2 } ` ,
17+ query : `statementTimeoutSecs=${ STATEMENT_TIMEOUT } ` ,
1718 payload : {
1819 query,
1920 } ,
@@ -41,7 +42,7 @@ describe('test query timeout', () => {
4142 test (
4243 'query without timeout parameter should not have timeout' ,
4344 async ( ) => {
44- const query = `SELECT pg_sleep(${ TIMEOUT } );`
45+ const query = `SELECT pg_sleep(${ TIMEOUT + 10 } );`
4546 // Execute a query that will sleep for 10 seconds without specifying timeout
4647 const res = await app . inject ( {
4748 method : 'POST' ,
You can’t perform that action at this time.
0 commit comments