Skip to content

Commit 3b201af

Browse files
committed
fix(async): MutliRunner burn CPU
Fixes #55.
1 parent d023430 commit 3b201af

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: src/MultiRunner.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,18 @@ public function wait(PromiseCore $targetCore = null): void
8585
{
8686
do {
8787
$status = curl_multi_exec($this->multiHandle, $active);
88+
curl_multi_select($this->multiHandle, 0.1);
8889
$info = curl_multi_info_read($this->multiHandle);
89-
if (false !== $info) {
90+
if ($info !== false) {
9091
$core = $this->findCoreByHandle($info['handle']);
9192

92-
if (null === $core) {
93+
if ($core === null) {
9394
// We have no promise for this handle. Drop it.
9495
curl_multi_remove_handle($this->multiHandle, $info['handle']);
9596
continue;
9697
}
9798

98-
if (CURLE_OK === $info['result']) {
99+
if ($info['result'] === CURLE_OK) {
99100
$core->fulfill();
100101
} else {
101102
$error = curl_error($core->getHandle());

0 commit comments

Comments
 (0)