Added check to read/write jobs.json if file is in use
Write jobs.json on change
This commit is contained in:
parent
0b77dc1172
commit
0f3da4ec81
@ -29,6 +29,8 @@ public class JobBoss : GlobalBase
|
|||||||
{
|
{
|
||||||
Log($"Added {job}");
|
Log($"Added {job}");
|
||||||
this.jobs.Add(job);
|
this.jobs.Add(job);
|
||||||
|
while(IsFileInUse(settings.jobsFilePath))
|
||||||
|
Thread.Sleep(10);
|
||||||
File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs));
|
File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,6 +55,9 @@ public class JobBoss : GlobalBase
|
|||||||
this.jobs.Remove(job);
|
this.jobs.Remove(job);
|
||||||
if(job.subJobs is not null)
|
if(job.subJobs is not null)
|
||||||
RemoveJobs(job.subJobs);
|
RemoveJobs(job.subJobs);
|
||||||
|
while(IsFileInUse(settings.jobsFilePath))
|
||||||
|
Thread.Sleep(10);
|
||||||
|
File.WriteAllText(settings.jobsFilePath, JsonConvert.SerializeObject(this.jobs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJobs(IEnumerable<Job> jobsToRemove)
|
public void RemoveJobs(IEnumerable<Job> jobsToRemove)
|
||||||
|
Loading…
Reference in New Issue
Block a user