Add UpdateCoversWorker

This commit is contained in:
2025-07-21 12:45:29 +02:00
parent 16c0cde526
commit 9d2dd2eabb
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using API.Schema.MangaContext;
namespace API.Workers;
public class UpdateCoversWorker(TimeSpan? interval = null, IEnumerable<BaseWorker>? dependsOn = null)
: BaseWorkerWithContext<MangaContext>(dependsOn), IPeriodic
{
public DateTime LastExecution { get; set; } = DateTime.UnixEpoch;
public TimeSpan Interval { get; set; } = interval ?? TimeSpan.FromHours(6);
protected override BaseWorker[] DoWorkInternal()
{
List<BaseWorker> workers = new();
foreach (MangaConnectorId<Manga> mangaConnectorId in DbContext.MangaConnectorToManga)
workers.Add(new DownloadCoverFromMangaconnectorWorker(mangaConnectorId));
return workers.ToArray();
}
}