Optimize GhCrateMeta::find: Cache url resolution result (#810)

So that we don't have to create multiple HEAD/GET http request to get
the final, redirected url.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-02-16 12:51:47 +11:00 committed by GitHub
parent a8b9ae6fda
commit 2e118b3044
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 50 deletions

View file

@ -84,11 +84,11 @@ async fn resolve_inner(
let mut handles: Vec<(Arc<dyn Fetcher>, _)> =
Vec::with_capacity(desired_targets.len() * resolvers.len());
let data = Arc::new(Data {
name: package_info.name.clone(),
version: package_info.version_str.clone(),
repo: package_info.repo.clone(),
});
let data = Arc::new(Data::new(
package_info.name.clone(),
package_info.version_str.clone(),
package_info.repo.clone(),
));
handles.extend(
desired_targets