File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,7 @@ public function __construct(?int $max_childs = null, bool $kill_childs = true)
25
25
throw new MissingExtensionException ("PCNTL Extension is missing in your PHP build " );
26
26
}
27
27
$ 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 ;
30
29
$ this ->kill_childs = $ kill_childs ;
31
30
32
31
register_tick_function ([$ this , "tick " ]);
@@ -153,7 +152,7 @@ public function __destruct()
153
152
154
153
public static function getCoresCount (): ?int
155
154
{
156
- if (isset (self ::$ cores_count )) return self ::$ cores_count ;
155
+ if (isset (self ::$ cores_count ) && self ::$ cores_count === 0 ) return null ;
157
156
158
157
if (defined ('PHP_WINDOWS_VERSION_MAJOR ' )){
159
158
$ str = trim (shell_exec ('wmic cpu get NumberOfCores 2>&1 ' ));
@@ -177,8 +176,8 @@ public static function getCoresCount(): ?int
177
176
}
178
177
}
179
178
180
- self ::$ cores_count = $ cores_count ?? null ;
181
- return self :: $ cores_count ;
179
+ self ::$ cores_count = $ cores_count ?? 0 ;
180
+ return $ cores_count ?? null ;
182
181
}
183
182
184
183
public static function breakpoint ($ value ){
You can’t perform that action at this time.
0 commit comments