mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-15 04:43:18 +02:00
Cover Endpoint wait for DownloadMangaCoverJob to finish if it exists
This commit is contained in:
parent
5f42a2d5ae
commit
d278a25f16
@ -109,7 +109,17 @@ public class MangaController(PgsqlContext context) : Controller
|
||||
if (m is null)
|
||||
return NotFound();
|
||||
if (!System.IO.File.Exists(m.CoverFileNameInCache))
|
||||
return NoContent();
|
||||
{
|
||||
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))
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
Image image = Image.Load(m.CoverFileNameInCache);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user