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)
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 ){
You can’t perform that action at this time.
0 commit comments