Use num_cpus instead of hardcoding the number of threads for dns look_up.
In the next hyper_tls relase it should be possible to use the existing cpu_pool executor.
This commit is contained in:
parent
120d494280
commit
d14973cf0d
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -625,6 +625,7 @@ dependencies = [
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
@ -25,6 +25,7 @@ tokio-core = "0.1.12"
|
||||
hyper-tls = "0.1.2"
|
||||
native-tls = "0.1.5"
|
||||
futures-cpupool = "0.1.8"
|
||||
num_cpus = "1.8.0"
|
||||
|
||||
[dependencies.diesel]
|
||||
features = ["sqlite", "r2d2"]
|
||||
|
||||
@ -44,6 +44,7 @@ extern crate hyper;
|
||||
extern crate hyper_tls;
|
||||
extern crate itertools;
|
||||
extern crate native_tls;
|
||||
extern crate num_cpus;
|
||||
extern crate rayon;
|
||||
extern crate reqwest;
|
||||
extern crate rfc822_sanitizer;
|
||||
|
||||
@ -10,6 +10,7 @@ use hyper::client::HttpConnector;
|
||||
use hyper_tls::HttpsConnector;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
use num_cpus;
|
||||
use rss;
|
||||
|
||||
use Source;
|
||||
@ -78,8 +79,7 @@ pub fn run(sources: Vec<Source>, ignore_etags: bool) -> Result<()> {
|
||||
let mut core = Core::new()?;
|
||||
let handle = core.handle();
|
||||
let client = Client::configure()
|
||||
// FIXME: numcpus instead of 4
|
||||
.connector(HttpsConnector::new(4, &handle)?)
|
||||
.connector(HttpsConnector::new(num_cpus::get(), &handle)?)
|
||||
.build(&handle);
|
||||
|
||||
pipeline(sources, ignore_etags, &mut core, pool, client)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user