mirror of https://github.com/fafhrd91/actix-net
workers(0) will default to num_cpus
This commit is contained in:
parent
8ace9264b7
commit
3702fe3c05
|
@ -1,5 +1,11 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* workers(0) defaults to num_cpus::get()
|
||||||
|
|
||||||
## [1.0.3] - 2020-05-19
|
## [1.0.3] - 2020-05-19
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -72,9 +72,12 @@ impl ServerBuilder {
|
||||||
/// Set number of workers to start.
|
/// Set number of workers to start.
|
||||||
///
|
///
|
||||||
/// By default server uses number of available logical cpu as workers
|
/// By default server uses number of available logical cpu as workers
|
||||||
/// count.
|
/// count. Explicitly setting 0 will also default.
|
||||||
pub fn workers(mut self, num: usize) -> Self {
|
pub fn workers(mut self, num: usize) -> Self {
|
||||||
self.threads = num;
|
self.threads = match num {
|
||||||
|
0 => num_cpus::get(),
|
||||||
|
_ => num,
|
||||||
|
};
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue