mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 00:22:40 +01:00
Fix restarts triggering when the same launch parameters are reloaded
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Tgstation.Server.Api.Models.Internal
|
||||
{
|
||||
@@ -36,5 +37,17 @@ namespace Tgstation.Server.Api.Models.Internal
|
||||
/// </summary>
|
||||
[Required]
|
||||
public uint? StartupTimeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Check if we match a given set of <paramref name="otherParameters"/>
|
||||
/// </summary>
|
||||
/// <param name="otherParameters">The <see cref="DreamDaemonLaunchParameters"/> to compare against</param>
|
||||
/// <returns><see langword="true"/> if they match, <see langword="false"/> otherwise</returns>
|
||||
public bool Match(DreamDaemonLaunchParameters otherParameters) =>
|
||||
AllowWebClient == otherParameters.AllowWebClient
|
||||
&& SecurityLevel == otherParameters.SecurityLevel
|
||||
&& PrimaryPort == otherParameters.PrimaryPort
|
||||
&& SecondaryPort == otherParameters.SecondaryPort
|
||||
&& StartupTimeout == otherParameters.StartupTimeout;
|
||||
}
|
||||
}
|
||||
@@ -617,6 +617,8 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (launchParameters.Match(ActiveLaunchParameters))
|
||||
return;
|
||||
ActiveLaunchParameters = launchParameters;
|
||||
if (Running)
|
||||
//queue an update
|
||||
@@ -780,6 +782,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
/// <inheritdoc />
|
||||
public async Task<WatchdogLaunchResult> Restart(bool graceful, CancellationToken cancellationToken)
|
||||
{
|
||||
logger.LogTrace("Begin Restart. Graceful: {0}", graceful);
|
||||
using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (!graceful || !Running)
|
||||
|
||||
Reference in New Issue
Block a user