Commit ff3409ed authored by Dominik Hebeler's avatar Dominik Hebeler

5 processes handling cache writes now

parent e3a3ca0c
...@@ -50,7 +50,15 @@ class RequestFetcher extends Command ...@@ -50,7 +50,15 @@ class RequestFetcher extends Command
*/ */
public function handle() public function handle()
{ {
$pid = \pcntl_fork(); $pids = [];
$pid = null;
for ($i = 0; $i < 5; $i++) {
$pid = \pcntl_fork();
$pids[] = $pid;
if ($pid === 0) {
break;
}
}
if ($pid === 0) { if ($pid === 0) {
Artisan::call('requests:cacher'); Artisan::call('requests:cacher');
exit; exit;
...@@ -124,8 +132,9 @@ class RequestFetcher extends Command ...@@ -124,8 +132,9 @@ class RequestFetcher extends Command
} finally { } finally {
curl_multi_close($this->multicurl); curl_multi_close($this->multicurl);
} }
foreach ($pids as $tmppid) {
\pcntl_waitpid($pid, $status, WNOHANG); \pcntl_waitpid($tmppid, $status, WNOHANG);
}
} }
private function getCurlHandle($job) private function getCurlHandle($job)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment