mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 19:37:33 +01:00
Remove log clutter and filewrites
This commit is contained in:
parent
c1aa4cf6b5
commit
87ea077281
@ -161,10 +161,7 @@ public class JobBoss : GlobalBase
|
|||||||
cachedPublications.Add(ncJob.manga);
|
cachedPublications.Add(ncJob.manga);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExportJobsList()
|
public void ExportJob(Job job)
|
||||||
{
|
|
||||||
Log("Exporting Jobs");
|
|
||||||
foreach (Job job in this.jobs)
|
|
||||||
{
|
{
|
||||||
string jobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
|
string jobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
|
||||||
string jobStr = JsonConvert.SerializeObject(job);
|
string jobStr = JsonConvert.SerializeObject(job);
|
||||||
@ -174,6 +171,12 @@ public class JobBoss : GlobalBase
|
|||||||
File.WriteAllText(jobFilePath, jobStr);
|
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
|
//Remove files with jobs not in this.jobs-list
|
||||||
Regex idRex = new (@"(.*)\.json");
|
Regex idRex = new (@"(.*)\.json");
|
||||||
foreach (FileInfo file in new DirectoryInfo(settings.jobsFolderPath).EnumerateFiles())
|
foreach (FileInfo file in new DirectoryInfo(settings.jobsFolderPath).EnumerateFiles())
|
||||||
@ -219,14 +222,13 @@ public class JobBoss : GlobalBase
|
|||||||
}
|
}
|
||||||
queueHead.ResetProgress();
|
queueHead.ResetProgress();
|
||||||
jobQueue.Dequeue();
|
jobQueue.Dequeue();
|
||||||
ExportJobsList();
|
ExportJob(queueHead);
|
||||||
Log($"Next job in {jobs.MinBy(job => job.nextExecution)?.nextExecution.Subtract(DateTime.Now)} {jobs.MinBy(job => job.nextExecution)?.id}");
|
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)
|
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
|
||||||
{
|
{
|
||||||
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray();
|
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray();
|
||||||
AddJobs(subJobs);
|
AddJobs(subJobs);
|
||||||
AddJobsToQueue(subJobs);
|
AddJobsToQueue(subJobs);
|
||||||
ExportJobsList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user