fix: workers supervisés + tiles régénérées après ingestion et au démarrage
This commit is contained in:
@@ -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()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user