Skip to content

Commit

Permalink
fix: don't schedule creator UDP updates during regeneration of the ch…
Browse files Browse the repository at this point in the history
…ar/creator xrefs

Don't schedule the AniDB Creator UDP updates during the regeneration of the character/creator cross-references in the database migration(s).
  • Loading branch information
revam committed Jan 14, 2025
1 parent 677b0e9 commit a480222
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Shoko.Server/Databases/DatabaseFixes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,9 @@ public static void RecreateAnimeCharactersAndCreators()
continue;
}

animeCreator.CreateCharacters(response.Characters, anime);
animeCreator.CreateCharacters(response.Characters, anime, skipCreatorScheduling: true);

animeCreator.CreateStaff(response.Staff, anime);
animeCreator.CreateStaff(response.Staff, anime, skipCreatorScheduling: true);

RepoFactory.AniDB_Anime.Save(anime);
}
Expand Down
10 changes: 6 additions & 4 deletions Shoko.Server/Providers/AniDB/HTTP/AnimeCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ public static bool CreateTags(List<ResponseTag> tags, SVR_AniDB_Anime anime)
return xrefsToSave.Count > 0 || xrefsToDelete.Count > 0;
}

public void CreateCharacters(List<ResponseCharacter> chars, SVR_AniDB_Anime anime)
public void CreateCharacters(List<ResponseCharacter> chars, SVR_AniDB_Anime anime, bool skipCreatorScheduling = false)
{
if (chars == null) return;

Expand Down Expand Up @@ -1056,10 +1056,11 @@ public void CreateCharacters(List<ResponseCharacter> chars, SVR_AniDB_Anime anim
_logger.LogError(ex, "Unable to save characters and creators for {MainTitle}", anime.MainTitle);
}

ScheduleCreators(creatorsToSchedule, anime.MainTitle);
if (!skipCreatorScheduling)
ScheduleCreators(creatorsToSchedule, anime.MainTitle);
}

public void CreateStaff(List<ResponseStaff> staffList, SVR_AniDB_Anime anime)
public void CreateStaff(List<ResponseStaff> staffList, SVR_AniDB_Anime anime, bool skipCreatorScheduling = false)
{
if (staffList == null) return;

Expand Down Expand Up @@ -1188,7 +1189,8 @@ public void CreateStaff(List<ResponseStaff> staffList, SVR_AniDB_Anime anime)
_logger.LogError(ex, "Unable to Save Staff for {MainTitle}", anime.MainTitle);
}

ScheduleCreators(creatorsToSchedule, anime.MainTitle);
if (!skipCreatorScheduling)
ScheduleCreators(creatorsToSchedule, anime.MainTitle);
}

private async void ScheduleCreators(IEnumerable<int> creatorIDs, string mainTitle)
Expand Down

0 comments on commit a480222

Please sign in to comment.