mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-18 22:33:18 +02:00
Cover Endpoint wait for DownloadMangaCoverJob to finish if it exists
This commit is contained in:
parent
5f42a2d5ae
commit
d278a25f16
@ -108,8 +108,18 @@ public class MangaController(PgsqlContext context) : Controller
|
|||||||
Manga? m = context.Manga.Find(MangaId);
|
Manga? m = context.Manga.Find(MangaId);
|
||||||
if (m is null)
|
if (m is null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
if (!System.IO.File.Exists(m.CoverFileNameInCache))
|
||||||
|
{
|
||||||
|
bool coverIsBeingDownloaded = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
coverIsBeingDownloaded = context.Jobs.Where(j => j.JobType == JobType.DownloadMangaCoverJob).AsEnumerable()
|
||||||
|
.Any(j => j is DownloadMangaCoverJob dmcj && dmcj.MangaId == MangaId);
|
||||||
|
Thread.Sleep(100);
|
||||||
|
} while (coverIsBeingDownloaded);
|
||||||
if (!System.IO.File.Exists(m.CoverFileNameInCache))
|
if (!System.IO.File.Exists(m.CoverFileNameInCache))
|
||||||
return NoContent();
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
Image image = Image.Load(m.CoverFileNameInCache);
|
Image image = Image.Load(m.CoverFileNameInCache);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user