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'
3
3
import { pgMeta } from '../lib/utils'
4
4
5
5
const TIMEOUT = ( Number ( process . env . PG_QUERY_TIMEOUT_SECS ) ?? 10 ) + 2
6
+ const STATEMENT_TIMEOUT = ( Number ( process . env . PG_QUERY_TIMEOUT_SECS ) ?? 10 ) + 1
6
7
7
8
describe ( 'test query timeout' , ( ) => {
8
9
test (
9
10
`query timeout after ${ TIMEOUT } s and connection cleanup` ,
10
11
async ( ) => {
11
- const query = `SELECT pg_sleep(${ TIMEOUT } );`
12
+ const query = `SELECT pg_sleep(${ TIMEOUT + 10 } );`
12
13
// Execute a query that will sleep for 10 seconds
13
14
const res = await app . inject ( {
14
15
method : 'POST' ,
15
16
path : '/query' ,
16
- query : `statementTimeoutSecs=${ TIMEOUT - 2 } ` ,
17
+ query : `statementTimeoutSecs=${ STATEMENT_TIMEOUT } ` ,
17
18
payload : {
18
19
query,
19
20
} ,
@@ -41,7 +42,7 @@ describe('test query timeout', () => {
41
42
test (
42
43
'query without timeout parameter should not have timeout' ,
43
44
async ( ) => {
44
- const query = `SELECT pg_sleep(${ TIMEOUT } );`
45
+ const query = `SELECT pg_sleep(${ TIMEOUT + 10 } );`
45
46
// Execute a query that will sleep for 10 seconds without specifying timeout
46
47
const res = await app . inject ( {
47
48
method : 'POST' ,
You can’t perform that action at this time.
0 commit comments