More cleanup for events

This commit is contained in:
Infi
2024-08-24 17:00:54 +02:00
parent c9be7c9c2c
commit c7a52e8edb
3 changed files with 13 additions and 10 deletions
+5 -1
View File
@@ -159,7 +159,7 @@ public class RouteController
{
Plugin.Log.Information($"Client connected: {ctx.Guid}");
var sse = new EventServer(Core.TokenSource.Token);
var sse = new SSEConnection(Core.TokenSource.Token);
Core.EventConnections.Add(sse);
// TODO Check if reconnect or new connection
@@ -167,6 +167,10 @@ public class RouteController
sse.OutboundStack.Push(new NewMessage(messages.ToArray()));
await sse.HandleEventLoop(ctx);
// It should always be done after return
if (sse.Done)
Core.EventConnections.Remove(sse);
}
catch (Exception ex)
{