mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-29 08:00:19 +01:00
Fix race condition between swarm server startup and health checking
This commit is contained in:
@@ -41,6 +41,11 @@ namespace Tgstation.Server.Host.Swarm
|
||||
/// </summary>
|
||||
const int UpdateCommitTimeoutMinutes = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Number of seconds between <see cref="forceHealthCheckTcs"/> triggering and a health check being performed.
|
||||
/// </summary>
|
||||
const int SecondsToDelayForcedHealthChecks = 15;
|
||||
|
||||
/// <summary>
|
||||
/// See <see cref="JsonSerializerSettings"/> for the swarm system.
|
||||
/// </summary>
|
||||
@@ -1060,7 +1065,13 @@ namespace Tgstation.Server.Host.Swarm
|
||||
|
||||
await awakeningTask.ConfigureAwait(false);
|
||||
|
||||
if (!swarmController && !nextForceHealthCheckTask.IsCompleted)
|
||||
if (nextForceHealthCheckTask.IsCompleted && swarmController)
|
||||
{
|
||||
// Intentionally wait a few seconds for the other server to start up before interogating it
|
||||
logger.LogTrace("Next health check triggering in {0}s...", SecondsToDelayForcedHealthChecks);
|
||||
await asyncDelayer.Delay(TimeSpan.FromSeconds(SecondsToDelayForcedHealthChecks), cancellationToken);
|
||||
}
|
||||
else if (!swarmController && !nextForceHealthCheckTask.IsCompleted)
|
||||
{
|
||||
if (!lastControllerHealthCheck.HasValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user