diff options
| author | Bobby <[email protected]> | 2026-02-24 16:48:00 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-02-24 16:48:00 +0530 |
| commit | d3507ae5b9d88a250b444c0e996fa07f84f6e3c5 (patch) | |
| tree | 64680e5ba7c9b4aa2e412c5bb9611df0e940d971 /tasks/anisync.task.go | |
| parent | c6ff27b989047cf0af8d6cf2aa86c8e80547cf10 (diff) | |
| download | metachan-d3507ae5b9d88a250b444c0e996fa07f84f6e3c5.tar.xz metachan-d3507ae5b9d88a250b444c0e996fa07f84f6e3c5.zip | |
feat: Refactor anime and character handling
- Removed old GetAnimeEpisodes and GetAnimeEpisodesByMALID functions, replaced with a new implementation in episodes.go.
- Added GetAnimeCharacters and GetAnimeCharacter functions to handle character retrieval.
- Introduced CharacterAnimeAppearance entity to track character appearances in anime.
- Updated repositories to manage character data and enrich character details.
- Implemented enriched_at timestamp for both anime and characters to track data updates.
- Added CharacterSync task to periodically enrich character data from the Jikan API.
- Updated router to include new character-related endpoints.
Diffstat (limited to 'tasks/anisync.task.go')
| -rw-r--r-- | tasks/anisync.task.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tasks/anisync.task.go b/tasks/anisync.task.go index 9aa64f0..bf650f3 100644 --- a/tasks/anisync.task.go +++ b/tasks/anisync.task.go @@ -86,8 +86,10 @@ func ResumeAnimeSync() { sevenDaysAgo := time.Now().Add(-7 * 24 * time.Hour) updatedAt := make(map[int]time.Time, len(stubs)) + enrichedAt := make(map[int]*time.Time, len(stubs)) for _, s := range stubs { updatedAt[s.MALID] = s.UpdatedAt + enrichedAt[s.MALID] = s.EnrichedAt } var toProcess []entities.Mapping @@ -96,7 +98,7 @@ func ResumeAnimeSync() { continue } t, exists := updatedAt[m.MAL] - if !exists || t.Before(sevenDaysAgo) { + if !exists || t.Before(sevenDaysAgo) || enrichedAt[m.MAL] == nil { toProcess = append(toProcess, m) } } |
