@@ -37,6 +37,7 @@ import { logger } from "../logutils";
37
37
import { RoundRobinHostSelector } from "./round_robin_host_selector" ;
38
38
import { AwsPoolClient } from "./aws_pool_client" ;
39
39
import { AwsPoolConfig } from "./aws_pool_config" ;
40
+ import { PoolClientWrapper } from "./pool_client_wrapper" ;
40
41
41
42
export class InternalPooledConnectionProvider implements PooledConnectionProvider , CanReleaseResources {
42
43
private static readonly acceptedStrategies : Map < string , HostSelector > = new Map ( [
@@ -108,28 +109,16 @@ export class InternalPooledConnectionProvider implements PooledConnectionProvide
108
109
const preparedConfig = dialect . preparePoolClientProperties ( props , this . _poolConfig ) ;
109
110
110
111
this . internalPool = this . databasePools . computeIfAbsent (
111
- new PoolKey ( hostInfo . url , this . getPoolKey ( hostInfo , props ) ) ,
112
+ new PoolKey ( connectionHostInfo . url , this . getPoolKey ( connectionHostInfo , props ) ) ,
112
113
( ) => dialect . getAwsPoolClient ( preparedConfig ) ,
113
114
this . poolExpirationCheckNanos
114
115
) ;
115
116
116
- const poolClient = await this . getPoolConnection ( ) ;
117
-
118
- return {
119
- client : poolClient ,
120
- hostInfo : connectionHostInfo ,
121
- properties : props
122
- } ;
123
- }
124
-
125
- async end ( pluginService : PluginService , clientWrapper : ClientWrapper | undefined ) : Promise < void > {
126
- if ( this . internalPool && clientWrapper ) {
127
- return this . internalPool . end ( clientWrapper . client ) ;
128
- }
117
+ return await this . getPoolConnection ( hostInfo , props ) ;
129
118
}
130
119
131
- async getPoolConnection ( ) {
132
- return this . internalPool ! . connect ( ) ;
120
+ async getPoolConnection ( hostInfo : HostInfo , props : Map < string , string > ) {
121
+ return new PoolClientWrapper ( this . internalPool ! . connect ( ) , this . internalPool ! , hostInfo , props ) ;
133
122
}
134
123
135
124
public async releaseResources ( ) {
0 commit comments