From fd134804a206db97306cab073dafca7f749cbbf0 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 15 Jul 2025 23:18:09 -0400 Subject: [PATCH] Queue runs batch of jobs --- cli/src/Command/Queue.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/src/Command/Queue.php b/cli/src/Command/Queue.php index 302ee0c..38df4d4 100644 --- a/cli/src/Command/Queue.php +++ b/cli/src/Command/Queue.php @@ -42,7 +42,14 @@ class Queue extends Command } $io->title("[{$now->format('Y-m-d H:i:s e')}] Running Queue..."); - return $this->runJob(); + $results = []; + for ($i = 0; $i < $this->batchSize; $i++) { + if ($this->jobService->getPending() === 0) { + break; + } + $results []= $this->runJob(); + } + return count(array_filter($results, fn ($result) => $result === self::FAILURE)) === 0 ? self::SUCCESS : self::FAILURE; } protected array $sections;