[PR #1042] [MERGED] Keep using the same hyper client #1208

Closed
opened 2026-02-27 20:01:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1042
Author: @dnlmlr
Created: 8/4/2022
Status: Merged
Merged: 8/15/2022
Merged by: @roderickvd

Base: devHead: core-keep-hyper-client


📝 Commits (1)

  • b588d9f Keep using the same hyper client

📊 Changes

1 file changed (+33 additions, -22 deletions)

View changed files

📝 core/src/http_client.rs (+33 -22)

📄 Description

  • Keep using the same hyper client instead of building a new one for each request
  • This allows the client to reuse connections and improves the performance of multiple requests by almost 2x
  • The playlist_tracks example takes 38 secs before and 20 secs after the change to enumerate a 180 track playlist
  • To avoid carrying the hyper Client generics through the whole project, ProxyConnector is always used as the Connector, but disabled when not using a proxy. This should have no real overhead
  • The client creation is done lazily to keep the HttpClient::new without a Result return type

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/1042 **Author:** [@dnlmlr](https://github.com/dnlmlr) **Created:** 8/4/2022 **Status:** ✅ Merged **Merged:** 8/15/2022 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `core-keep-hyper-client` --- ### 📝 Commits (1) - [`b588d9f`](https://github.com/librespot-org/librespot/commit/b588d9fd0701a80ad318d79dcb14f77458545174) Keep using the same hyper client ### 📊 Changes **1 file changed** (+33 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `core/src/http_client.rs` (+33 -22) </details> ### 📄 Description - Keep using the same hyper client instead of building a new one for each request - This allows the client to reuse connections and improves the performance of multiple requests by almost 2x - The playlist_tracks example takes 38 secs before and 20 secs after the change to enumerate a 180 track playlist - To avoid carrying the hyper Client generics through the whole project, `ProxyConnector` is always used as the Connector, but disabled when not using a proxy. This should have no real overhead - The client creation is done lazily to keep the `HttpClient::new` without a `Result` return type --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:01:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#1208
No description provided.