Browse Source

util: use only one DNS resolver per Hyper client

Peter Cai 1 year ago
parent
commit
795f2ca5d6
Signed by: Peter Cai <[email protected]> GPG Key ID: 71F5FB4E4F3FD54F
4 changed files with 1 additions and 5 deletions
  1. 0
    1
      Cargo.lock
  2. 0
    1
      Cargo.toml
  3. 0
    1
      src/main.rs
  4. 1
    2
      src/util.rs

+ 0
- 1
Cargo.lock View File

@@ -811,7 +811,6 @@ dependencies = [
811 811
  "http 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
812 812
  "hyper 0.12.9 (registry+https://github.com/rust-lang/crates.io-index)",
813 813
  "hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
814
- "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
815 814
  "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
816 815
  "terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
817 816
  "tokio 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",

+ 0
- 1
Cargo.toml View File

@@ -11,7 +11,6 @@ futures = "0.1"
11 11
 http = "0.1"
12 12
 hyper = "0.12"
13 13
 hyper-rustls = "0.14"
14
-num_cpus = "1.0"
15 14
 percent-encoding = "1.0"
16 15
 terminal_size = "0.1"
17 16
 tokio = "0.1"

+ 0
- 1
src/main.rs View File

@@ -6,7 +6,6 @@ extern crate futures;
6 6
 extern crate http;
7 7
 extern crate hyper;
8 8
 extern crate hyper_rustls;
9
-extern crate num_cpus;
10 9
 extern crate percent_encoding;
11 10
 extern crate terminal_size;
12 11
 extern crate tokio;

+ 1
- 2
src/util.rs View File

@@ -6,7 +6,6 @@ use http::request::Builder as ReqBuilder;
6 6
 use hyper::{Body, client, Client, header, Uri, Response};
7 7
 use hyper::body::Payload;
8 8
 use hyper_rustls::HttpsConnector;
9
-use num_cpus;
10 9
 use std::error;
11 10
 use std::time::Duration;
12 11
 use tokio::fs;
@@ -14,7 +13,7 @@ use tokio::fs;
14 13
 pub fn hyper_client<B: Payload>() -> Client<HttpsConnector<client::HttpConnector>, B> {
15 14
     client::Builder::default()
16 15
         .keep_alive(true)
17
-        .build(HttpsConnector::new(num_cpus::get()))
16
+        .build(HttpsConnector::new(1))
18 17
 }
19 18
 
20 19
 // Create a file with length

Loading…
Cancel
Save