fix: workers supervisés + tiles régénérées après ingestion et au démarrage

This commit is contained in:
Gwadaking
2026-04-14 00:31:46 -04:00
parent e0ed71535e
commit 96dc79a297
2 changed files with 46 additions and 7 deletions

View File

@@ -9,7 +9,9 @@ use App\Service\Forecast\ImpactScoreService;
use App\Service\Ingestion\IngestionService;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Process\Process;
/**
* Exécute le pipeline complet à chaque tick du scheduler :
@@ -35,6 +37,7 @@ final class IngestionScheduleHandler
private ImpactScoreService $scores,
private EntityManagerInterface $em,
private LoggerInterface $logger,
#[Autowire('%kernel.project_dir%')] private string $projectDir,
) {}
public function __invoke(IngestionScheduleMessage $message): void
@@ -94,5 +97,24 @@ final class IngestionScheduleHandler
}
$this->logger->info('Scheduled ingestion completed');
// Étape 4 : régénération des vector tiles depuis les données fraîches
$this->regenerateTiles();
}
private function regenerateTiles(): void
{
$process = new Process(
['php', 'bin/console', 'app:generate-tiles', '--env=prod', '--no-debug'],
$this->projectDir
);
$process->setTimeout(300);
$process->run();
if ($process->isSuccessful()) {
$this->logger->info('Vector tiles regenerated');
} else {
$this->logger->error('Tile generation failed', ['output' => $process->getErrorOutput()]);
}
}
}