Skip to content

Commit faf360d

Browse files
committed
max childs default is now 10 instead of 50
1 parent 0475cad commit faf360d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Pool.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public function __construct(?int $max_childs = null, bool $kill_childs = true)
2525
throw new MissingExtensionException("PCNTL Extension is missing in your PHP build");
2626
}
2727
$this->pid = getmypid();
28-
$max_childs ??= (self::getCoresCount() ?? 1) * 50;
29-
$this->max_childs = $max_childs;
28+
$this->max_childs = $max_childs ?? (self::getCoresCount() ?? 1) * 10;
3029
$this->kill_childs = $kill_childs;
3130

3231
register_tick_function([$this, "tick"]);
@@ -153,7 +152,7 @@ public function __destruct()
153152

154153
public static function getCoresCount(): ?int
155154
{
156-
if(isset(self::$cores_count)) return self::$cores_count;
155+
if(isset(self::$cores_count) && self::$cores_count === 0) return null;
157156

158157
if (defined('PHP_WINDOWS_VERSION_MAJOR')){
159158
$str = trim(shell_exec('wmic cpu get NumberOfCores 2>&1'));
@@ -177,8 +176,8 @@ public static function getCoresCount(): ?int
177176
}
178177
}
179178

180-
self::$cores_count = $cores_count ?? null;
181-
return self::$cores_count;
179+
self::$cores_count = $cores_count ?? 0;
180+
return $cores_count ?? null;
182181
}
183182

184183
public static function breakpoint($value){

0 commit comments

Comments
 (0)