Skip to content

Commit 6a81288

Browse files
sybbeardriesvints
andauthored
[1.x] Fix issue where timed out tasks were not taken into account (#396)
* Fix issue where timed out tasks were not taken into account * Update SwooleTaskDispatcher.php Co-authored-by: Dries Vints <[email protected]>
1 parent e5abf72 commit 6a81288

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Swoole/SwooleTaskDispatcher.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ public function resolve(array $tasks, int $waitMilliseconds = 3000): array
4343
$i = 0;
4444

4545
foreach ($tasks as $key => $task) {
46-
if ($results[$i] instanceof TaskExceptionResult) {
47-
throw $results[$i]->getOriginal();
48-
}
46+
if (isset($results[$i])) {
47+
if ($results[$i] instanceof TaskExceptionResult) {
48+
throw $results[$i]->getOriginal();
49+
}
4950

50-
$tasks[$key] = isset($results[$i]) ? $results[$i]->result : false;
51+
$tasks[$key] = $results[$i]->result;
52+
} else {
53+
$tasks[$key] = false;
54+
}
5155

5256
$i++;
5357
}

0 commit comments

Comments
 (0)