mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 14:37:44 +01:00
@@ -232,7 +232,6 @@ namespace Tgstation.Server.Host.Components.Chat
|
||||
channelIdCounter += (ulong)results.Count;
|
||||
}
|
||||
|
||||
Task trackingContextUpdateTask;
|
||||
lock (mappedChannels)
|
||||
{
|
||||
lock (providers)
|
||||
@@ -245,16 +244,9 @@ namespace Tgstation.Server.Host.Components.Chat
|
||||
mappedChannels.Add(newId, newMapping);
|
||||
newMapping.Channel.RealId = newId;
|
||||
}
|
||||
|
||||
lock (trackingContexts)
|
||||
trackingContextUpdateTask = Task.WhenAll(
|
||||
trackingContexts.Select(
|
||||
x => x.UpdateChannels(
|
||||
mappedChannels.Select(y => y.Value.Channel).ToList(),
|
||||
cancellationToken)));
|
||||
}
|
||||
|
||||
await trackingContextUpdateTask;
|
||||
await UpdateTrackingContexts(cancellationToken);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -472,6 +464,18 @@ namespace Tgstation.Server.Host.Components.Chat
|
||||
return context;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task UpdateTrackingContexts(CancellationToken cancellationToken)
|
||||
{
|
||||
lock (mappedChannels)
|
||||
lock (trackingContexts)
|
||||
return Task.WhenAll(
|
||||
trackingContexts.Select(
|
||||
x => x.UpdateChannels(
|
||||
mappedChannels.Select(y => y.Value.Channel).ToList(),
|
||||
cancellationToken)));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RegisterCommandHandler(ICustomCommandHandler customCommandHandler)
|
||||
{
|
||||
|
||||
@@ -84,5 +84,12 @@ namespace Tgstation.Server.Host.Components.Chat
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="IChatTrackingContext"/>.</returns>
|
||||
IChatTrackingContext CreateTrackingContext();
|
||||
|
||||
/// <summary>
|
||||
/// Force an update with the active channels on all active <see cref="IChatTrackingContext"/>s.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the running operation.</returns>
|
||||
Task UpdateTrackingContexts(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,8 +384,11 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
{
|
||||
if (core.Watchdog != this)
|
||||
throw new InvalidOperationException(Instance.DifferentCoreExceptionMessage);
|
||||
|
||||
using (await SemaphoreSlimContext.Lock(synchronizationSemaphore, ct))
|
||||
await LaunchNoLock(true, true, true, reattachInfo, ct);
|
||||
|
||||
await Chat.UpdateTrackingContexts(ct);
|
||||
},
|
||||
cancellationToken)
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user