diff --git a/src/Tgstation.Server.Host/Components/DreamMaker.cs b/src/Tgstation.Server.Host/Components/DreamMaker.cs index 1816ad5b00..aaeb1204e3 100644 --- a/src/Tgstation.Server.Host/Components/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/DreamMaker.cs @@ -224,6 +224,8 @@ namespace Tgstation.Server.Host.Components /// public async Task Compile(string projectName, int apiValidateTimeout, IRepository repository, CancellationToken cancellationToken) { + logger.LogTrace("Begin Compile"); + await eventConsumer.HandleEvent(EventType.CompileStart, new List{ repository.Origin }, cancellationToken).ConfigureAwait(false); try { Status = CompilerStatus.Copying; @@ -284,13 +286,13 @@ namespace Tgstation.Server.Host.Components if (!ddVerified) //server never validated or compile failed - await CleanupFailedCompile().ConfigureAwait(false); + await Task.WhenAll(CleanupFailedCompile(), eventConsumer.HandleEvent(EventType.CompileFailure, new List { job.ExitCode == 0 ? "1" : "0" }, cancellationToken)).ConfigureAwait(false); else { job.DMApiValidated = true; Status = CompilerStatus.Duplicating; - + //duplicate the dmb et al await ioManager.CopyDirectory(dirA, dirB, null, cancellationToken).ConfigureAwait(false); @@ -298,8 +300,10 @@ namespace Tgstation.Server.Host.Components //symlink in the static data var symATask = configuration.SymlinkStaticFilesTo(fullDirA, cancellationToken); - await configuration.SymlinkStaticFilesTo(ioManager.ResolvePath(dirB), cancellationToken).ConfigureAwait(false); - await symATask.ConfigureAwait(false); + var symBTask = configuration.SymlinkStaticFilesTo(ioManager.ResolvePath(dirB), cancellationToken); + + await Task.WhenAll(symATask, symBTask).ConfigureAwait(false); + await eventConsumer.HandleEvent(EventType.CompileComplete, null, cancellationToken).ConfigureAwait(false); } await compileJobConsumer.LoadCompileJob(job, cancellationToken).ConfigureAwait(false); return job; @@ -310,6 +314,11 @@ namespace Tgstation.Server.Host.Components throw; } } + catch (OperationCanceledException) + { + await eventConsumer.HandleEvent(EventType.CompileCancelled, null, default).ConfigureAwait(false); + throw; + } finally { Status = CompilerStatus.Idle; diff --git a/src/Tgstation.Server.Host/Components/EventType.cs b/src/Tgstation.Server.Host/Components/EventType.cs index fa8b5a2b29..53e6c9c9bd 100644 --- a/src/Tgstation.Server.Host/Components/EventType.cs +++ b/src/Tgstation.Server.Host/Components/EventType.cs @@ -44,7 +44,7 @@ ByondChangeComplete = 8, /// - /// Parameters: Commit sha, parameter of + /// Parameters: Origin commit sha /// CompileStart = 9, /// @@ -52,7 +52,7 @@ /// CompileCancelled = 10, /// - /// Parameters: Error string + /// Parameters: "1" if compile succeeded and api validation failed, "0" otherwise /// CompileFailure = 11, ///