Fix parallelization

This commit is contained in:
Daniil Gentili 2020-10-18 15:23:12 +02:00
parent bbc25e9aec
commit 906a0ab888
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -980,12 +980,12 @@ trait PeerHandler
return $promises;
}
$yielded = yield Tools::all($promises);
$yielded = [...yield Tools::all($promises)];
while ($yielded) {
$newYielded = [];
foreach (\array_chunk([...$yielded], 10) as $promises) {
$newYielded = \array_merge(yield Tools::all($promises), $newYielded);
foreach (\array_chunk($yielded, 10) as $promises) {
$newYielded = \array_merge($newYielded, ...(yield Tools::all($promises)));
}
$yielded = $newYielded;