fix: Crash before starting on OpenBSD
core_affinity doesn't return any cores on OpenBSD, so we try to clamp(1, 0). This is Less Good than fixing that crate, but at least allows the server to start up.
This commit is contained in:
parent
776b5865ba
commit
92a848f74d
1 changed files with 7 additions and 5 deletions
|
|
@ -385,11 +385,13 @@ fn num_senders(args: &crate::Args<'_>) -> usize {
|
|||
const MIN_SENDERS: usize = 1;
|
||||
// Limit the number of senders to the number of workers threads or number of
|
||||
// cores, conservatively.
|
||||
let max_senders = args
|
||||
.server
|
||||
.metrics
|
||||
.num_workers()
|
||||
.min(available_parallelism());
|
||||
let mut max_senders = args.server.metrics.num_workers();
|
||||
|
||||
// Work around some platforms not returning the number of cores.
|
||||
let num_cores = available_parallelism();
|
||||
if num_cores > 0 {
|
||||
max_senders = max_senders.min(num_cores);
|
||||
}
|
||||
|
||||
// If the user doesn't override the default 0, this is intended to then default
|
||||
// to 1 for now as multiple senders is experimental.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue