From 6d1a1c914af692fcae6db619bb0f2450f025b13c Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 13 May 2025 15:15:20 -0400 Subject: [PATCH] Wait for execution --- cli/src/Command/BaseLoop.php | 3 ++- cli/src/Service/Schedule.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/src/Command/BaseLoop.php b/cli/src/Command/BaseLoop.php index f51cc4e..642ba46 100644 --- a/cli/src/Command/BaseLoop.php +++ b/cli/src/Command/BaseLoop.php @@ -35,9 +35,10 @@ class BaseLoop extends Console\Command\Command $output->writeln('Starting loop...'); while (true) { - $commands = $this->scheduleService->run(); + $commands = $this->scheduleService->getPending(); foreach ($commands as $command) { $this->runCommand($input, $output, $command); + sleep(10); } } return self::SUCCESS; diff --git a/cli/src/Service/Schedule.php b/cli/src/Service/Schedule.php index a04f1c3..a902856 100644 --- a/cli/src/Service/Schedule.php +++ b/cli/src/Service/Schedule.php @@ -12,7 +12,7 @@ class Schedule protected string $filename = '/var/spool/cron/crontabs/root'; - public function run(): array + public function getPending(): array { $now = new DateTimeImmutable(); $schedule = $this->getCommandList();