perf: batch Wikidata SPARQL queries per film instead of per actor
Use a VALUES clause to fetch awards for all actors of a film in a single SPARQL request, reducing Wikidata API calls from ~20 per film to 1 and avoiding idle timeout errors from rate limiting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -57,9 +57,8 @@ readonly class ImportFilmsBatchMessageHandler
|
||||
} else {
|
||||
$this->actorSyncer->syncActorsForMovie($movie);
|
||||
|
||||
foreach ($movie->getActors() as $role) {
|
||||
$this->awardImporter->importForActor($role->getActor());
|
||||
}
|
||||
$actors = array_map(fn ($role) => $role->getActor(), $movie->getActors()->toArray());
|
||||
$this->awardImporter->importForActors($actors);
|
||||
|
||||
$user = $this->em->getReference(\App\Entity\User::class, $userId);
|
||||
$existingLink = $this->em->getRepository(UserMovie::class)->findOneBy([
|
||||
|
||||
Reference in New Issue
Block a user