fix: handle if num_cpus / 2 == 0 (#2740)

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-11-14 14:44:10 +08:00
committed by GitHub
parent dc46e96879
commit e2a770f8de

View File

@@ -92,7 +92,7 @@ impl MitoConfig {
// Sanitize worker num.
let num_workers_before = self.num_workers;
if self.num_workers == 0 {
self.num_workers = num_cpus::get() / 2;
self.num_workers = (num_cpus::get() / 2).max(1);
}
if num_workers_before != self.num_workers {
warn!(