Added check if jobQueue is empty
This commit is contained in:
parent
0f3da4ec81
commit
eebe25a378
@ -60,10 +60,11 @@ public class JobBoss : GlobalBase
|
|||||||
File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs));
|
File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJobs(IEnumerable<Job> jobsToRemove)
|
public void RemoveJobs(IEnumerable<Job?> jobsToRemove)
|
||||||
{
|
{
|
||||||
Log($"Removing {jobsToRemove.Count()} jobs.");
|
Log($"Removing {jobsToRemove.Count()} jobs.");
|
||||||
foreach (Job job in jobsToRemove)
|
foreach (Job? job in jobsToRemove)
|
||||||
|
if(job is not null)
|
||||||
RemoveJob(job);
|
RemoveJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +144,8 @@ public class JobBoss : GlobalBase
|
|||||||
AddJobToQueue(job);
|
AddJobToQueue(job);
|
||||||
foreach (Queue<Job> jobQueue in mangaConnectorJobQueue.Values)
|
foreach (Queue<Job> jobQueue in mangaConnectorJobQueue.Values)
|
||||||
{
|
{
|
||||||
|
if(jobQueue.Count < 1)
|
||||||
|
continue;
|
||||||
Job queueHead = jobQueue.Peek();
|
Job queueHead = jobQueue.Peek();
|
||||||
if (queueHead.progressToken.state is ProgressToken.State.Complete)
|
if (queueHead.progressToken.state is ProgressToken.State.Complete)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user