Fix errored bridge events not sending their completion events

This commit is contained in:
Jordan Dominion
2025-02-09 15:26:24 -05:00
parent 0d6fedf87a
commit f8cf529937
2 changed files with 15 additions and 3 deletions
@@ -52,7 +52,7 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
public ushort? TopicPort { get; set; }
/// <summary>
/// The <see cref="Bridge.CustomEventInvocation"/> being triggered.
/// The <see cref="CustomEventInvocation"/> being triggered.
/// </summary>
public CustomEventInvocation? EventInvocation { get; set; }
@@ -1171,14 +1171,26 @@ namespace Tgstation.Server.Host.Components.Session
{
try
{
await eventTask.Value;
Exception? exception;
try
{
await eventTask.Value;
exception = null;
}
catch (Exception ex)
{
exception = ex;
}
if (notifyCompletion.Value)
await SendCommand(
new TopicParameters(eventId),
cancellationToken);
else
else if (exception == null)
Logger.LogTrace("Finished custom event {eventId}, not sending notification.", eventId);
if (exception != null)
throw exception;
}
catch (OperationCanceledException ex)
{