Merge pull request #5281 from Ombi-app/fix-dupes-2

fix(emby): actually fix the dupes
This commit is contained in:
Jamie Rees 2025-10-14 22:52:17 +01:00 committed by GitHub
commit b030cdbe98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -223,6 +223,12 @@ namespace Ombi.Schedule.Jobs.Emby
{
await _repo.AddRange(epToAdd);
_logger.LogInformation($"Committed {epToAdd.Count} episodes to database. Progress: {processed}/{total}");
// Update the episode lookup with newly added episodes to prevent duplicates in subsequent batches
foreach (var episode in epToAdd)
{
episodeLookup.Add(episode.EmbyId);
}
}
epToAdd.Clear();
episodesInCurrentBatch.Clear();
@ -240,9 +246,14 @@ namespace Ombi.Schedule.Jobs.Emby
{
await _repo.AddRange(epToAdd);
_logger.LogInformation($"Final commit: {epToAdd.Count} episodes");
// Update the episode lookup with newly added episodes
foreach (var episode in epToAdd)
{
episodeLookup.Add(episode.EmbyId);
}
}
}
private bool _disposed;
protected virtual void Dispose(bool disposing)
{
@ -262,4 +273,4 @@ namespace Ombi.Schedule.Jobs.Emby
GC.SuppressFinalize(this);
}
}
}
}