Fix #250 old jobs getting re-exported.
This commit is contained in:
parent
9dfbe89e87
commit
09fdb6e5f1
@ -191,6 +191,7 @@ public class JobBoss : GlobalBase
|
|||||||
string newJobFilePath = Path.Join(TrangaSettings.jobsFolderPath, $"{job.id}.json");
|
string newJobFilePath = Path.Join(TrangaSettings.jobsFolderPath, $"{job.id}.json");
|
||||||
string oldFilePath = Path.Join(TrangaSettings.jobsFolderPath, oldFile);
|
string oldFilePath = Path.Join(TrangaSettings.jobsFolderPath, oldFile);
|
||||||
|
|
||||||
|
//Delete old file
|
||||||
if (File.Exists(oldFilePath))
|
if (File.Exists(oldFilePath))
|
||||||
{
|
{
|
||||||
Log($"Deleting Job-file {oldFilePath}");
|
Log($"Deleting Job-file {oldFilePath}");
|
||||||
@ -205,12 +206,16 @@ public class JobBoss : GlobalBase
|
|||||||
Log(e.ToString());
|
Log(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log($"Exporting Job {newJobFilePath}");
|
//Export job (in new file) if it is still in our jobs list
|
||||||
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
|
if (GetJobById(job.id) is not null)
|
||||||
while(IsFileInUse(newJobFilePath))
|
{
|
||||||
Thread.Sleep(10);
|
Log($"Exporting Job {newJobFilePath}");
|
||||||
File.WriteAllText(newJobFilePath, jobStr);
|
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
|
||||||
|
while(IsFileInUse(newJobFilePath))
|
||||||
|
Thread.Sleep(10);
|
||||||
|
File.WriteAllText(newJobFilePath, jobStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAllJobFiles()
|
private void UpdateAllJobFiles()
|
||||||
|
Loading…
Reference in New Issue
Block a user