From 7edff031350b177a1b43308c2b78d6e3ef3012b2 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 20 Jun 2017 22:11:15 -0400 Subject: [PATCH] Adds an event for when staged updates are applied --- TGServerService/Compiler.cs | 7 ++++++- TGServerService/Interop.cs | 8 ++++++++ TGServerService/ServerService.cs | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/TGServerService/Compiler.cs b/TGServerService/Compiler.cs index ba8e0b5c0a..1b0a0d1c36 100644 --- a/TGServerService/Compiler.cs +++ b/TGServerService/Compiler.cs @@ -49,6 +49,8 @@ namespace TGServerService bool compilationCancellationRequestation = false; bool canCancelCompilation = false; + bool UpdateStaged = false; + //deletes leftovers and checks current status void InitCompiler() { @@ -446,11 +448,14 @@ namespace TGServerService } } } - var msg = String.Format("Compile complete!{0}", DaemonStatus() == TGDreamDaemonStatus.Offline ? "" : " Server will update next round."); + var staged = DaemonStatus() != TGDreamDaemonStatus.Offline; + var msg = String.Format("Compile complete!{0}", !staged ? "" : " Server will update next round."); SendMessage("DM: " + msg); TGServerService.WriteInfo(msg, TGServerService.EventID.DMCompileSuccess); lock (CompilerLock) { + if (staged) + UpdateStaged = true; lastCompilerError = null; compilerCurrentStatus = TGCompilerStatus.Initialized; //still fairly valid } diff --git a/TGServerService/Interop.cs b/TGServerService/Interop.cs index eeca148179..c1d503875f 100644 --- a/TGServerService/Interop.cs +++ b/TGServerService/Interop.cs @@ -55,6 +55,14 @@ namespace TGServerService break; case SRWorldReboot: TGServerService.WriteInfo("World Rebooted", TGServerService.EventID.WorldReboot); + lock (CompilerLock) + { + if (UpdateStaged) + { + UpdateStaged = false; + TGServerService.WriteInfo("Staged update applied", TGServerService.EventID.ServerUpdateApplied); + } + } break; } } diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index d5431366c3..a135d8f6c0 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -71,7 +71,8 @@ namespace TGServerService RepoChangelog = 56000, RepoChangelogFail = 57000, ServiceShutdownFail = 61000, - WorldReboot = 62000, + WorldReboot = 62000, + ServerUpdateApplied = 63000, } static TGServerService ActiveService; //So everyone else can write to our eventlog