Fix job recovery not assigning StoppedAt

This commit is contained in:
Jordan Brown
2018-09-02 13:00:41 -04:00
committed by GitHub
parent 938b0814be
commit f47a298ac2
+2 -1
View File
@@ -158,7 +158,7 @@ namespace Tgstation.Server.Host.Core
var databaseContext = scope.ServiceProvider.GetRequiredService<IDatabaseContext>();
//mark all jobs as cancelled
var badJobs = await databaseContext.Jobs.Where(y => !y.Cancelled.Value && !y.StoppedAt.HasValue).Select(y => y.Id).ToListAsync(cancellationToken).ConfigureAwait(false);
var badJobs = await databaseContext.Jobs.Where(y => !y.StoppedAt.HasValue).Select(y => y.Id).ToListAsync(cancellationToken).ConfigureAwait(false);
if (badJobs.Count > 0)
{
logger.LogTrace("Cleaning {0} unfinished jobs...", badJobs.Count);
@@ -167,6 +167,7 @@ namespace Tgstation.Server.Host.Core
var job = new Job { Id = I };
databaseContext.Jobs.Attach(job);
job.Cancelled = true;
job.StoppedAt = DateTimeOffset.Now;
}
await databaseContext.Save(cancellationToken).ConfigureAwait(false);
}