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 {
10
10
this . _pool = this . initializePool ( connectionString ) ;
11
11
}
12
12
async connect ( ) : Promise < boolean > {
13
- let client ;
13
+ let client : PoolClient | null = null ;
14
14
try {
15
15
client = await this . _pool . connect ( ) ;
16
16
logger . info ( 'Database connection successful' ) ;
@@ -37,7 +37,6 @@ export class ConnectionPool {
37
37
return false ;
38
38
}
39
39
} finally {
40
- // Release client only if it was successfully acquired
41
40
if ( client ) {
42
41
client . release ( ) ;
43
42
}
@@ -77,7 +76,7 @@ export class ConnectionPool {
77
76
} ) ;
78
77
}
79
78
async reinitializePool ( ) {
80
- if ( this . _pool ) {
79
+ if ( this . _pool && ! this . _pool . ended ) {
81
80
await this . _pool . end ( ) ;
82
81
}
83
82
const newConnectionString = this . getConnectionString ( ) ;
You can’t perform that action at this time.
0 commit comments