This commit is contained in:
AffectedArc07
2021-01-10 14:06:02 +00:00
parent 129d1e7b63
commit a447dd323d
3 changed files with 12 additions and 2 deletions
@@ -111,6 +111,12 @@ namespace Tgstation.Server.Host.Components.Events
/// Before the watchdog launches. No parameters.
/// </summary>
[EventScript("WatchdogLaunch")]
WatchdogLaunch
WatchdogLaunch,
/// <summary>
/// Inbetween DD restarts if the process has been force-ended by the DMAPI (TgsEndProcess())
/// </summary>
[EventScript("WorldEndProcess")]
WorldEndProcess,
}
}
@@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging;
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models.Internal;
@@ -91,6 +92,9 @@ namespace Tgstation.Server.Host.Components.Watchdog
switch (reason)
{
case MonitorActivationReason.ActiveServerCrashed:
if (Server.TerminationWasRequested)
await eventConsumer.HandleEvent(EventType.WorldEndProcess, Enumerable.Empty<string>(), cancellationToken).ConfigureAwait(false);
string exitWord = Server.TerminationWasRequested ? "exited" : "crashed";
if (Server.RebootState == Session.RebootState.Shutdown)
{
@@ -121,7 +121,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// <summary>
/// The <see cref="IEventConsumer"/> that is not the <see cref="WatchdogBase"/>
/// </summary>
readonly IEventConsumer eventConsumer;
public IEventConsumer eventConsumer;
/// <summary>
/// The <see cref="IRemoteDeploymentManagerFactory"/> for the <see cref="WatchdogBase"/>.