2
0

Compare commits

..

No commits in common. "96e2845a5b22e1d5fcec2c5a1d31bf4ab57df540" and "18edcef1c3159013af86fab722e6721d64e0178a" have entirely different histories.

2 changed files with 27 additions and 14 deletions

View File

@ -20,7 +20,7 @@ COPY Tranga/Tranga.csproj /src/Tranga/Tranga.csproj
RUN dotnet restore /src/Tranga.sln
COPY . /src/
RUN dotnet publish -c Release --property:OutputPath=/publish -maxcpucount:1
RUN dotnet publish -c Release -o /publish -maxcpucount:1
FROM base AS runtime
EXPOSE 6531

View File

@ -163,7 +163,6 @@ public class JobBoss : GlobalBase
{
Log($"Adding Job {job}");
this.jobs.Add(job);
UpdateJobFile(job, file.Name);
}
}
@ -204,23 +203,23 @@ public class JobBoss : GlobalBase
internal void UpdateJobFile(Job job, string? oldFile = null)
{
string newJobFilePath = Path.Join(TrangaSettings.jobsFolderPath, $"{job.id}.json");
string oldFilePath = Path.Join(TrangaSettings.jobsFolderPath, oldFile);
if (File.Exists(oldFilePath))
if (!this.jobs.Any(jjob => jjob.id == job.id))
{
Log($"Deleting Job-file {oldFilePath}");
try
{
while(IsFileInUse(oldFilePath))
Log($"Deleting Job-file {newJobFilePath}");
while(IsFileInUse(newJobFilePath))
Thread.Sleep(10);
File.Delete(oldFilePath);
File.Delete(newJobFilePath);
}
catch (Exception e)
{
Log(e.ToString());
}
}
else
{
Log($"Exporting Job {newJobFilePath}");
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
while(IsFileInUse(newJobFilePath))
@ -228,6 +227,20 @@ public class JobBoss : GlobalBase
File.WriteAllText(newJobFilePath, jobStr);
}
if(oldFile is not null)
try
{
Log($"Deleting old Job-file {oldFile}");
while(IsFileInUse(oldFile))
Thread.Sleep(10);
File.Delete(oldFile);
}
catch (Exception e)
{
Log(e.ToString());
}
}
private void UpdateAllJobFiles()
{
Log("Exporting Jobs");