-
Notifications
You must be signed in to change notification settings - Fork 12
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
Reuse HTTP client for download #53
Comments
What if use something like a singleton? I.e. I can implement a struct that will have a one-field |
To be clearer, this issue is concerned with reusing the client to avoid establishing a brand new connection with each request. I expect in practice responses tend not to repeat since each download will hit a different URL for a different dependency. |
Thank you for clarification. I am new to Rust, it's look like this issue is to difficult for me at this point |
In the main branch I see that the client is already a part of the Artifactory struct. Is this still relevant? |
Partially, though less so. A new client is still created for each dependency explored when constructing the dependency graph as part of the I had a PR that solved this as part of moving the responsibility of instancing clients to a central RegistryProvider that would lazily create a single client as necessary for each registry URI, but I abandoned that PR because it assumed we'd want co-existing Registry implementations, which was not true. That said, there is nothing intrinsically wrong with that design, it's just that instead of trait objects it would be better off using generics. Only reason I haven't pushed that change forward is because this is not a pressing optimisation at the moment. So if you feel like contributing it, go ahead, I'd be happy to review. |
The implementation of the
download
method for the Artifactory registry creates a new HTTP client in each call. To take advantage of connection pooling, it should reuse the client instead.buffrs/src/registry/artifactory.rs
Line 91 in ef3e64f
The text was updated successfully, but these errors were encountered: