fix: alerte critique si 0 zones ingérées + lastIngestionJob dans /api/status
This commit is contained in:
@@ -43,15 +43,33 @@ final class IngestionScheduleHandler
|
||||
$this->logger->info('Scheduled ingestion started', ['date' => $date->format('Y-m-d')]);
|
||||
|
||||
// Étape 1 : ingestion de toutes les zones
|
||||
$succeeded = 0;
|
||||
$failed = 0;
|
||||
foreach (self::ZONES as $name => $bbox) {
|
||||
try {
|
||||
$this->ingestion->ingestWithFallback($bbox, $date);
|
||||
$this->logger->info('Zone ingested', ['zone' => $name]);
|
||||
++$succeeded;
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger->error('Ingestion failed', ['zone' => $name, 'error' => $e->getMessage()]);
|
||||
++$failed;
|
||||
}
|
||||
}
|
||||
|
||||
if ($succeeded === 0) {
|
||||
$this->logger->critical('All zones failed — no data ingested this cycle', [
|
||||
'date' => $date->format('Y-m-d'),
|
||||
'zones' => array_keys(self::ZONES),
|
||||
'count' => $failed,
|
||||
]);
|
||||
} else {
|
||||
$this->logger->info('Ingestion cycle summary', [
|
||||
'succeeded' => $succeeded,
|
||||
'failed' => $failed,
|
||||
'date' => $date->format('Y-m-d'),
|
||||
]);
|
||||
}
|
||||
|
||||
// Étape 2 : forecasts pour les observations sans prévision
|
||||
$observations = $this->em->getRepository(SargassumObservation::class)
|
||||
->createQueryBuilder('o')
|
||||
|
||||
Reference in New Issue
Block a user