mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-12 06:27:54 +02:00
Scoped PGSql Contexts for Threads
This commit is contained in:
@ -12,7 +12,7 @@ public class DownloadNewChaptersJob(ulong recurrenceMs, string mangaId, string?
|
||||
public string MangaId { get; init; } = mangaId;
|
||||
public virtual Manga Manga { get; init; }
|
||||
|
||||
public override IEnumerable<Job> Run()
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
{
|
||||
MangaConnector connector = Manga.MangaConnector;
|
||||
Chapter[] newChapters = connector.GetNewChapters(Manga);
|
||||
|
@ -18,7 +18,7 @@ public class DownloadSingleChapterJob(string chapterId, string? parentJobId = nu
|
||||
public string ChapterId { get; init; } = chapterId;
|
||||
public virtual Chapter Chapter { get; init; }
|
||||
|
||||
public override IEnumerable<Job> Run()
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
{
|
||||
MangaConnector connector = Chapter.ParentManga.MangaConnector;
|
||||
DownloadChapterImages(Chapter);
|
||||
|
@ -36,5 +36,13 @@ public abstract class Job
|
||||
NextExecution = LastExecution.AddMilliseconds(RecurrenceMs);
|
||||
}
|
||||
|
||||
public abstract IEnumerable<Job> Run();
|
||||
public IEnumerable<Job> Run()
|
||||
{
|
||||
this.state = JobState.Running;
|
||||
IEnumerable<Job>? newJobs = RunInternal();
|
||||
this.state = JobState.Completed;
|
||||
return newJobs;
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<Job> RunInternal();
|
||||
}
|
@ -6,7 +6,7 @@ public class MoveFileOrFolderJob(string fromLocation, string toLocation, string?
|
||||
public string FromLocation { get; init; } = fromLocation;
|
||||
public string ToLocation { get; init; } = toLocation;
|
||||
|
||||
public override IEnumerable<Job> Run()
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public class UpdateMetadataJob(ulong recurrenceMs, string mangaId, string? paren
|
||||
public string MangaId { get; init; } = mangaId;
|
||||
public virtual Manga Manga { get; init; }
|
||||
|
||||
public override IEnumerable<Job> Run()
|
||||
protected override IEnumerable<Job> RunInternal()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
Reference in New Issue
Block a user