mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 20:08:19 +02:00
Add UpdateCoversWorker
This commit is contained in:
19
API/Workers/PeriodicWorkers/UpdateCoversWorker.cs
Normal file
19
API/Workers/PeriodicWorkers/UpdateCoversWorker.cs
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user