1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:34:04 +00:00

minor improvements to parallelization logic

This commit is contained in:
Samuel Štancl 2024-09-29 12:42:29 +02:00
parent 075789eb91
commit 303b52d25a

View file

@ -68,7 +68,7 @@ trait ParallelCommand
} }
// This should return the total number of logical cores on any BSD-based system // This should return the total number of logical cores on any BSD-based system
if ($ffi->sysctlbyname('hw.ncpu', FFI::addr($cores), FFI::addr($size), null, 0) == -1) { if ($ffi->sysctlbyname('hw.ncpu', FFI::addr($cores), FFI::addr($size), null, 0) !== 0) {
return -1; return -1;
} }
@ -104,7 +104,7 @@ trait ParallelCommand
$processes = (int) $processes; $processes = (int) $processes;
} }
if ($processes < 0) { // can come from sysctlGetLogicalCoreCount() if ($processes < 1) {
$this->components->error('Minimum value for processes is 1. Try specifying -p manually.'); $this->components->error('Minimum value for processes is 1. Try specifying -p manually.');
exit(1); exit(1);
} }