Compare commits

..

No commits in common. "cb6482ebaece7b03477d3b3e8adbd385bc934b03" and "c1aa4cf6b57f5a765f1949cb3a2be47fdf40a06f" have entirely different histories.

View File

@ -14,7 +14,6 @@ public class JobBoss : GlobalBase
this.jobs = new();
LoadJobsList(connectors);
this.mangaConnectorJobQueue = new();
Log($"Next job in {jobs.MinBy(job => job.nextExecution)?.nextExecution.Subtract(DateTime.Now)} {jobs.MinBy(job => job.nextExecution)?.id}");
}
public void AddJob(Job job)
@ -162,7 +161,10 @@ public class JobBoss : GlobalBase
cachedPublications.Add(ncJob.manga);
}
public void ExportJob(Job job)
public void ExportJobsList()
{
Log("Exporting Jobs");
foreach (Job job in this.jobs)
{
string jobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
string jobStr = JsonConvert.SerializeObject(job);
@ -172,12 +174,6 @@ public class JobBoss : GlobalBase
File.WriteAllText(jobFilePath, jobStr);
}
public void ExportJobsList()
{
Log("Exporting Jobs");
foreach (Job job in this.jobs)
ExportJob(job);
//Remove files with jobs not in this.jobs-list
Regex idRex = new (@"(.*)\.json");
foreach (FileInfo file in new DirectoryInfo(settings.jobsFolderPath).EnumerateFiles())
@ -223,13 +219,14 @@ public class JobBoss : GlobalBase
}
queueHead.ResetProgress();
jobQueue.Dequeue();
ExportJob(queueHead);
ExportJobsList();
Log($"Next job in {jobs.MinBy(job => job.nextExecution)?.nextExecution.Subtract(DateTime.Now)} {jobs.MinBy(job => job.nextExecution)?.id}");
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
{
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray();
AddJobs(subJobs);
AddJobsToQueue(subJobs);
ExportJobsList();
}
}
}