2
0

Merge branch 'refs/heads/cuttingedge-merge-ServerV2' into Server-V2

This commit is contained in:
Glax 2024-09-18 18:47:28 +02:00
commit 7b6724ad38

View File

@ -206,6 +206,7 @@ public class JobBoss : GlobalBase
string newJobFilePath = Path.Join(TrangaSettings.jobsFolderPath, $"{job.id}.json");
string oldFilePath = Path.Join(TrangaSettings.jobsFolderPath, oldFile);
//Delete old file
if (File.Exists(oldFilePath))
{
Log($"Deleting Job-file {oldFilePath}");
@ -220,12 +221,16 @@ public class JobBoss : GlobalBase
Log(e.ToString());
}
}
Log($"Exporting Job {newJobFilePath}");
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
while(IsFileInUse(newJobFilePath))
Thread.Sleep(10);
File.WriteAllText(newJobFilePath, jobStr);
//Export job (in new file) if it is still in our jobs list
if (GetJobById(job.id) is not null)
{
Log($"Exporting Job {newJobFilePath}");
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
while(IsFileInUse(newJobFilePath))
Thread.Sleep(10);
File.WriteAllText(newJobFilePath, jobStr);
}
}
private void UpdateAllJobFiles()