diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-11-18 17:28:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-18 17:28:14 -0500 |
commit | 763d492ed69c3a22310dd5c758995fbbbf3e06b8 (patch) | |
tree | da78f6e3ed7cc38924a73c2118b5824bcdb60e69 /cli/proc_state.rs | |
parent | 6962808f4b6bfa18312820f710bc57c17980531d (diff) |
fix(npm): use an http client with connection pool (#16705)
Should make downloading npm packages faster and more reliable.
Diffstat (limited to 'cli/proc_state.rs')
-rw-r--r-- | cli/proc_state.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cli/proc_state.rs b/cli/proc_state.rs index 9e66bdb66..a193adc53 100644 --- a/cli/proc_state.rs +++ b/cli/proc_state.rs @@ -19,6 +19,7 @@ use crate::graph_util::graph_lock_or_exit; use crate::graph_util::GraphData; use crate::graph_util::ModuleEntry; use crate::http_cache; +use crate::http_util::HttpClient; use crate::lockfile::as_maybe_locker; use crate::lockfile::Lockfile; use crate::node; @@ -157,15 +158,18 @@ impl ProcState { let root_cert_store = cli_options.resolve_root_cert_store()?; let cache_usage = cli_options.cache_setting(); let progress_bar = ProgressBar::default(); + let http_client = HttpClient::new( + Some(root_cert_store.clone()), + cli_options + .unsafely_ignore_certificate_errors() + .map(ToOwned::to_owned), + )?; let file_fetcher = FileFetcher::new( http_cache, cache_usage, !cli_options.no_remote(), - Some(root_cert_store.clone()), + http_client.clone(), blob_store.clone(), - cli_options - .unsafely_ignore_certificate_errors() - .map(ToOwned::to_owned), Some(progress_bar.clone()), )?; @@ -216,12 +220,14 @@ impl ProcState { let npm_cache = NpmCache::from_deno_dir( &dir, cli_options.cache_setting(), + http_client.clone(), progress_bar.clone(), ); let api = RealNpmRegistryApi::new( registry_url, npm_cache.clone(), cli_options.cache_setting(), + http_client, progress_bar.clone(), ); let maybe_lockfile = lockfile.as_ref().cloned(); |