DownloadSingleChapterJob only spawn one Job per Queue for Manga

This commit is contained in:
Glax 2025-05-16 14:46:36 +02:00
parent d08544b892
commit a5954ed5c8

View File

@ -97,7 +97,16 @@ public class DownloadSingleChapterJob : Job
Chapter.Downloaded = true; Chapter.Downloaded = true;
context.SaveChanges(); context.SaveChanges();
return [new UpdateFilesDownloadedJob(Chapter.ParentManga, 0, this)]; if (context.Jobs.AsEnumerable().Any(j =>
{
if (j.JobType != JobType.UpdateFilesDownloadedJob)
return false;
UpdateFilesDownloadedJob job = (UpdateFilesDownloadedJob)j;
return job.MangaId == this.Chapter.ParentMangaId;
}))
return [];
return [new UpdateFilesDownloadedJob(Chapter.ParentManga, 0, this.ParentJob)];
} }
private void ProcessImage(string imagePath) private void ProcessImage(string imagePath)