2
0

better logging for removing files

This commit is contained in:
glax 2023-09-19 23:24:39 +02:00
parent b6cdb07e3f
commit 482fcb7102

View File

@ -165,12 +165,12 @@ public class JobBoss : GlobalBase
public void ExportJob(Job job)
{
string jobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
Log($"Exporting Job {jobFilePath}");
if (!this.jobs.Any(jjob => jjob.id == job.id))
{
try
{
Log($"Deleting Job-file {jobFilePath}");
while(IsFileInUse(jobFilePath))
Thread.Sleep(10);
File.Delete(jobFilePath);
@ -182,6 +182,7 @@ public class JobBoss : GlobalBase
}
else
{
Log($"Exporting Job {jobFilePath}");
string jobStr = JsonConvert.SerializeObject(job);
while(IsFileInUse(jobFilePath))
Thread.Sleep(10);