feat(activity): mises à jour temps réel des jobs via Mercure

- Ajoute jobId dans ChapterScrapingStarted et ChapterScrapingFailed
- Publie job.created (PENDING) depuis ScrapeChapterStateProcessor
- Publie job.status_changed (in_progress/completed/failed) depuis ScrapingEventSubscriber
- Gère job.created et job.status_changed dans activityStore : ajout instantané et suppression différée (1.5s)
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-17 16:19:40 +01:00
parent a7e6879e83
commit 07d1b2daed
7 changed files with 87 additions and 6 deletions

View File

@@ -45,7 +45,7 @@ readonly class ScrapeChapterHandler
$job->start();
$this->jobRepository->save($job);
$this->eventBus->dispatch(new ChapterScrapingStarted($manga->getTitle(), $chapter->chapterNumber));
$this->eventBus->dispatch(new ChapterScrapingStarted($job->id, $manga->getTitle(), $chapter->chapterNumber));
$sources = $this->getSourcesToTry($manga);
$slugsToTry = array_merge([$manga->getSlug()], $manga->getAlternativeSlugs());
@@ -106,7 +106,7 @@ readonly class ScrapeChapterHandler
$errorMessage = $lastException?->getMessage() ?? 'Failed to scrape chapter from all available sources';
$job->fail($errorMessage);
$this->jobRepository->save($job);
$this->eventBus->dispatch(new ChapterScrapingFailed($chapter->mangaId, $chapter->chapterNumber, $errorMessage));
$this->eventBus->dispatch(new ChapterScrapingFailed($job->id, $chapter->mangaId, $chapter->chapterNumber, $errorMessage));
}
}