@@ -205,8 +205,8 @@ const getTestOpDefinitions = (threadContext: ThreadContext) => ({
205
205
clear : function ( { interruptInUseConnections } : { interruptInUseConnections : boolean } ) {
206
206
return threadContext . pool . clear ( { interruptInUseConnections } ) ;
207
207
} ,
208
- close : async function ( ) {
209
- return await promisify ( ConnectionPool . prototype . close ) . call ( threadContext . pool ) ;
208
+ close : function ( ) {
209
+ return ConnectionPool . prototype . close . call ( threadContext . pool ) ;
210
210
} ,
211
211
ready : function ( ) {
212
212
return threadContext . pool . ready ( ) ;
@@ -328,28 +328,20 @@ export class ThreadContext {
328
328
329
329
closePool ( ) {
330
330
this . #server. pool = this . #originalServerPool;
331
- return new Promise ( resolve => {
332
- ALL_POOL_EVENTS . forEach ( ev => this . pool . removeAllListeners ( ev ) ) ;
333
- this . pool . close ( resolve ) ;
334
- } ) ;
331
+ ALL_POOL_EVENTS . forEach ( ev => this . pool . removeAllListeners ( ev ) ) ;
332
+ this . pool . close ( ) ;
335
333
}
336
334
337
335
async tearDown ( ) {
338
336
if ( this . pool ) {
339
- await this . closePool ( ) ;
337
+ this . closePool ( ) ;
340
338
}
341
339
const connectionsToDestroy = Array . from ( this . orphans ) . concat (
342
340
Array . from ( this . connections . values ( ) )
343
341
) ;
344
- const promises = connectionsToDestroy . map ( conn => {
345
- return new Promise < void > ( ( resolve , reject ) =>
346
- conn . destroy ( { force : true } , err => {
347
- if ( err ) return reject ( err ) ;
348
- resolve ( ) ;
349
- } )
350
- ) ;
351
- } ) ;
352
- await Promise . all ( promises ) ;
342
+ for ( const conn of connectionsToDestroy ) {
343
+ conn . destroy ( ) ;
344
+ }
353
345
this . poolEventsEventEmitter . removeAllListeners ( ) ;
354
346
}
355
347
}
0 commit comments