Skip to content

Commit 558abf7

Browse files
authored
fix(concurrency): skip Octane::concurrently when no tasks to prevent false TaskTimeoutException (#1071)
This patch prevents unnecessary calls to Octane::concurrently() when the $tasks array is empty. Without this guard, Octane sometimes triggers a misleading TaskTimeoutException: Task timed out after 30000 milliseconds — even when there are no actual tasks to run. This happens because Octane initializes the task pool regardless of input size, and an empty collection causes its internal wait cycle to expire. By returning an empty array early, we: avoid wasting resources initializing a no-op concurrent pool; prevent false timeouts and misleading error logs; improve the reliability of concurrency handling for cases where dynamic task lists may be empty.
1 parent c9ca504 commit 558abf7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Concerns/ProvidesConcurrencySupport.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ trait ProvidesConcurrencySupport
2323
*/
2424
public function concurrently(array $tasks, int $waitMilliseconds = 3000)
2525
{
26+
if (empty($tasks)) {
27+
return [];
28+
}
29+
2630
return $this->tasks()->resolve($tasks, $waitMilliseconds);
2731
}
2832

0 commit comments

Comments
 (0)