Fix infinite loop of DownloadNewChaptersTask

This commit is contained in:
2023-06-19 22:32:32 +02:00
parent a4c9168551
commit 6cdccdf66b
3 changed files with 29 additions and 30 deletions

View File

@ -1,5 +1,4 @@
using Logging;
using Newtonsoft.Json;
namespace Tranga.TrangaTasks;
@ -33,12 +32,10 @@ public class DownloadNewChaptersTask : TrangaTask
foreach (Chapter newChapter in newChapters)
{
DownloadChapterTask newTask = new (Task.DownloadChapter, this.connectorName, pub, newChapter, this.language, this);
taskManager.AddTask(newTask);
this.childTasks.Add(newTask);
newTask.state = ExecutionState.Enqueued;
taskManager.AddTask(newTask);
}
if(newChapters.Count > 0)
foreach(NotificationManager nm in taskManager.settings.notificationManagers)
nm.SendNotification(pub.sortName, $"Downloading {newChapters.Count} new Chapters.");
}
public override string ToString()