-
Notifications
You must be signed in to change notification settings - Fork 1.7k
refactor(fetch) : light use only one DNS
thread
#9647
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cmd.light
flag is already checked here so alternatively could pass in the number of threads as a parameter in execute_impl
and execute_light_impl
.
util/fetch/src/client.rs
Outdated
thread::Builder::new().name("fetch".into()).spawn(move || { | ||
let mut core = match reactor::Core::new() { | ||
Ok(c) => c, | ||
Err(e) => return tx_start.send(Err(e)).unwrap_or(()) | ||
}; | ||
|
||
let handle = core.handle(); | ||
let number_dns_threads = if is_light { 1 } else { 4 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing the flag down you could pass the number of threads as a parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's better, will change it!
parity/run.rs
Outdated
@@ -283,7 +283,7 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<Runnin | |||
let cpu_pool = CpuPool::new(4); | |||
|
|||
// fetch service | |||
let fetch = fetch::Client::new().map_err(|e| format!("Error starting fetch client: {:?}", e))?; | |||
let fetch = fetch::Client::new(cmd.light).map_err(|e| format!("Error starting fetch client: {:?}", e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always be true so could just pass in 1
here
parity/run.rs
Outdated
@@ -477,7 +477,7 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq: | |||
let event_loop = EventLoop::spawn(); | |||
|
|||
// fetch service | |||
let fetch = fetch::Client::new().map_err(|e| format!("Error starting fetch client: {:?}", e))?; | |||
let fetch = fetch::Client::new(cmd.light).map_err(|e| format!("Error starting fetch client: {:?}", e))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always be false so could just pass in 4
here
2bb4b46
to
ac3e528
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
const VERIFY_PASSWORD_HINT: &str = "Make sure valid password is present in files passed using `--password` or in the configuration file."; | ||
|
||
// Full client number of DNS threads | ||
const FETCH_FULL_NUM_DNS_THREADS: usize = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt we actually need all 4 for the full node either. But fine with keeping it the same for backward compatibility.
…mon-deps * origin/master: CI: Remove unnecessary pipes (#9681) test.sh: use cargo --target for platforms other than linux, win or mac (#9650) ci: fix push script (#9679) Hardfork the testnets (#9562) Calculate sha3 instead of sha256 for push-release. (#9673) ethcore-io retries failed work steal (#9651) fix(light_fetch): avoid race with BlockNumber::Latest (#9665) Test fix for windows cache name... (#9658) refactor(fetch) : light use only one `DNS` thread (#9647)
Attempt to close #9623