File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ describe('lifetime timeout', () => {
21
21
} )
22
22
it ( 'connection lifetime should expire and remove the client after the client is done working' , ( done ) => {
23
23
const pool = new Pool ( { maxLifetimeSeconds : 1 } )
24
- pool . query ( 'SELECT pg_sleep(1.01 )' )
24
+ pool . query ( 'SELECT pg_sleep(1.4 )' )
25
25
pool . on ( 'remove' , ( ) => {
26
26
console . log ( 'expired while busy - on-remove event' )
27
27
expect ( pool . expiredCount ) . to . equal ( 0 )
@@ -33,10 +33,11 @@ describe('lifetime timeout', () => {
33
33
'can remove expired clients and recreate them' ,
34
34
co . wrap ( function * ( ) {
35
35
const pool = new Pool ( { maxLifetimeSeconds : 1 } )
36
- let query = pool . query ( 'SELECT pg_sleep(1)' )
36
+ let query = pool . query ( 'SELECT pg_sleep(1.4 )' )
37
37
expect ( pool . expiredCount ) . to . equal ( 0 )
38
38
expect ( pool . totalCount ) . to . equal ( 1 )
39
39
yield query
40
+ yield new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) )
40
41
expect ( pool . expiredCount ) . to . equal ( 0 )
41
42
expect ( pool . totalCount ) . to . equal ( 0 )
42
43
yield pool . query ( 'SELECT NOW()' )
You can’t perform that action at this time.
0 commit comments