Queue runs batch of jobs

This commit is contained in:
Juan Pablo Vial
2025-07-15 23:18:09 -04:00
parent d3d6940842
commit fd134804a2

View File

@ -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;