perf: reduce relations api calls by parsing relations directly from full anime endpoints

This commit is contained in:
2026-04-08 16:33:44 +02:00
parent 618b807b3d
commit 2780c8338f
3 changed files with 10 additions and 34 deletions

View File

@@ -80,13 +80,13 @@ func (w *Worker) syncRelations(ctx context.Context) {
time.Sleep(400 * time.Millisecond)
}()
relations, err := w.client.GetRelationsData(int(a.ID))
animeData, err := w.client.GetAnimeByID(int(a.ID))
if err != nil {
log.Printf("worker: failed to fetch relations for %d: %v", a.ID, err)
log.Printf("worker: failed to fetch anime details for %d: %v", a.ID, err)
return
}
for _, rel := range relations.Data {
for _, rel := range animeData.Relations {
for _, entry := range rel.Entry {
if entry.Type == "anime" {
// We just insert the relation.