-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
close wallet connections methods #5
base: master
Are you sure you want to change the base?
Conversation
08ff3a0
to
fe29ea2
Compare
I'm not convinced about have a per-wallet connection pool. We have people using this library with hundreds of wallets, and this would likely lead to resource exhaustion on either server or client. Could this be looked at whilst retaining the global connection pool? I'd also change |
Sure, I made a slight modification. Now, we can pass an optional parameter via the Otherwise, it will enable dedicated connections pool for wallets with specific certificate. So, the usage will be like: Open(
context.Background(),
WithName("Test wallet"),
WithCredentials(credentials.NewTLS(nil)),
WithEndpoints([]*Endpoint{{host: "localhost", port: 12345}}),
WithConnectionProviderName(uuid.NewString()),
)
Done, now wallet have just |
use global connection pool with optional wallet connection name
5902442
to
ba404f1
Compare
close wallet connections methods wealdtech#5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I lost track of this PR. Please could you rebase it and address the last outstanding item here, and I'll merge it? Thanks.
@@ -67,7 +67,7 @@ func Open(ctx context.Context, | |||
wallet.timeout = parameters.timeout | |||
wallet.endpoints = make([]*Endpoint, len(parameters.endpoints)) | |||
wallet.connectionProvider = &PuddleConnectionProvider{ | |||
name: parameters.name, | |||
name: parameters.connectionName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
is mandatory but connectionname
is not. So I think that this should use connectionName
if present, otherwise it should fall back to using name
.
For cases when connection to dirk go through short-living certifications, current implementation not allow re-load changed certificates because of in-memory pool of grpc connections. Even if certificate was re-loaded and wallet re-created, all connections trigger error because of cached connections
to avoid this added modification - move connection map from global to package to build in to struct
PuddleConnectionProvider
to prevent of leak memory for unused old connections was added function
CloseConnections