File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export class ConnectionPool {
1010 this . _pool = this . initializePool ( connectionString ) ;
1111 }
1212 async connect ( ) : Promise < boolean > {
13- let client ;
13+ let client : PoolClient | null = null ;
1414 try {
1515 client = await this . _pool . connect ( ) ;
1616 logger . info ( 'Database connection successful' ) ;
@@ -37,7 +37,6 @@ export class ConnectionPool {
3737 return false ;
3838 }
3939 } finally {
40- // Release client only if it was successfully acquired
4140 if ( client ) {
4241 client . release ( ) ;
4342 }
@@ -77,7 +76,7 @@ export class ConnectionPool {
7776 } ) ;
7877 }
7978 async reinitializePool ( ) {
80- if ( this . _pool ) {
79+ if ( this . _pool && ! this . _pool . ended ) {
8180 await this . _pool . end ( ) ;
8281 }
8382 const newConnectionString = this . getConnectionString ( ) ;
You can’t perform that action at this time.
0 commit comments