From 02c27eb52da9e65bd42f079f4cf36345d32b8c66 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 23 Nov 2023 18:01:40 -0500 Subject: [PATCH] Probably fix shutdown delay condition with sessions --- .../Components/Chat/ChatTrackingContext.cs | 2 +- .../Components/Session/SessionController.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs b/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs index 369ccdeeeb..03c9ee2e54 100644 --- a/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs +++ b/src/Tgstation.Server.Host/Components/Chat/ChatTrackingContext.cs @@ -16,7 +16,7 @@ namespace Tgstation.Server.Host.Components.Chat /// public bool Active { - get => active; + get => active && onDispose != null; set { if (active == value) diff --git a/src/Tgstation.Server.Host/Components/Session/SessionController.cs b/src/Tgstation.Server.Host/Components/Session/SessionController.cs index d3feab14a6..9094cdf527 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionController.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionController.cs @@ -337,9 +337,8 @@ namespace Tgstation.Server.Host.Components.Session Logger.LogTrace("Disposing..."); - // yield then acquire the topic semaphore to prevent new calls from starting - await Task.Yield(); - (await topicSendSemaphore.Lock(CancellationToken.None)).Dispose(); // DCT: None available + reattachTopicCts.Cancel(); + var semaphoreLockTask = topicSendSemaphore.Lock(CancellationToken.None); // DCT: None available if (!released) { @@ -363,6 +362,7 @@ namespace Tgstation.Server.Host.Components.Session if (!released) await Lifetime; // finish the async callback + (await semaphoreLockTask).Dispose(); topicSendSemaphore.Dispose(); }