From 505ac81d5c92da77c09cc7db80d55e6c0064503d Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 10 Oct 2018 16:39:09 -0400 Subject: [PATCH] Remove unecessary if --- src/Tgstation.Server.Host/Core/JobManager.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Tgstation.Server.Host/Core/JobManager.cs b/src/Tgstation.Server.Host/Core/JobManager.cs index c6130ec133..614661ac0e 100644 --- a/src/Tgstation.Server.Host/Core/JobManager.cs +++ b/src/Tgstation.Server.Host/Core/JobManager.cs @@ -151,20 +151,21 @@ namespace Tgstation.Server.Host.Core job.StartedAt = DateTimeOffset.Now; job.Cancelled = false; + job.Instance = new Instance { Id = job.Instance.Id }; databaseContext.Instances.Attach(job.Instance); - if (job.StartedBy != null) + + job.StartedBy = new User { - job.StartedBy = new User - { - Id = job.StartedBy.Id - }; - databaseContext.Users.Attach(job.StartedBy); - } + Id = job.StartedBy.Id + }; + databaseContext.Users.Attach(job.StartedBy); + databaseContext.Jobs.Add(job); + await databaseContext.Save(cancellationToken).ConfigureAwait(false); logger.LogDebug("Starting job {0}: {1}...", job.Id, job.Description); var jobHandler = JobHandler.Create(x => RunJob(job, (jobParam, serviceProvider, ct) =>