-
Notifications
You must be signed in to change notification settings - Fork 98
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
Performance: Add MakeClientWithTransport client override that allows the user to pass a custom http transport #520
Conversation
…ass a custom http RoundTripper (transport) The sdk previously only used the default http client and the default client, using the default transport has severe limitations for apps making multiple connections to the same host. This new method will allow users to pass a new Transport instance which has new values for things like MaxIdleConnsPerHost and MaxIdleConns.
client/v2/common/common.go
Outdated
@@ -139,7 +154,7 @@ func (client *Client) submitFormRaw(ctx context.Context, path string, params int | |||
|
|||
// Supply the client token. | |||
req.Header.Set(client.apiHeader, client.apiToken) | |||
// Add the client headers. | |||
// Add the client headers.π |
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.
pi?
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.
no, π
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.
I think repo standard is 22/7
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.
lol - darn hotkeys w/ focus in wrong place. I'll fix. 😀
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.
Looks like a good idea to me, would like to see some use of it in algodclientv2_test.go
There are probably better summaries but here's one I found quickly describing why this is so important: For backend services using multiple goroutines which make many requests to algod instances (which will all be the same url), this should allow for a massive speed improvement. |
Add generated files for algod
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.
I definitely disagree about adding a cucumber test for this. The transport interface is specific to the go SDK, so no need test the other SDKs.
@bbroder-algo could you elaborate about what you had in mind? At most I'd think a unit test in common_test.go
would be sufficient.
Regenerate import for indexer
The sdk previously only used the default http client and the default client, using the default transport has severe limitations for apps making multiple connections to the same host. This new method will allow users to pass a new Transport instance which has new values for things like MaxIdleConnsPerHost and MaxIdleConns.