FIX: esperar al siguiente minuto

This commit is contained in:
Juan Pablo Vial
2025-05-13 15:47:18 -04:00
parent 5ac324de6a
commit ee74fc7588

View File

@ -40,7 +40,11 @@ class BaseLoop extends Console\Command\Command
// wait for next minute // wait for next minute
$now = new DateTimeImmutable(); $now = new DateTimeImmutable();
$nextMinute = new DateTimeImmutable($now->format('Y-m-d H:i:00')); $nextMinute = new DateTimeImmutable($now->format('Y-m-d H:i:00'));
$nextMinute->add(new \DateInterval('PT1M')); $nextMinute = $nextMinute->add(new \DateInterval('PT1M'));
$this->logger->debug('Wait', [
'now' => $now->format('Y-m-d H:i:s.u'),
'nextMinute' => $nextMinute->format('Y-m-d H:i:s.u'),
]);
$diff = $nextMinute->getTimestamp() - $now->getTimestamp(); $diff = $nextMinute->getTimestamp() - $now->getTimestamp();
if ($diff > 0) { if ($diff > 0) {
$output->writeln("Waiting {$diff} seconds..."); $output->writeln("Waiting {$diff} seconds...");