fix(communication): DebugStreamService drops the session on an InstanceNotFound snapshot (review 2026-10-21 03/M-3)
This commit is contained in:
@@ -207,6 +207,19 @@ public class DebugStreamService : IDisposable
|
||||
ex);
|
||||
}
|
||||
|
||||
if (snapshot.InstanceNotFound)
|
||||
{
|
||||
// The bridge actor already stopped itself on the not-found snapshot. Do not keep a
|
||||
// live-looking session for it (review 2026-10-21 03/M-3): a consumer that never
|
||||
// calls StopStream (the SignalR hub just forwards the flag) left the row in the
|
||||
// registry until disconnect, and every keepalive round Telling a dead actor.
|
||||
_sessions.TryRemove(sessionId, out _);
|
||||
_logger.LogInformation(
|
||||
"Debug stream for {Instance} on site {Site} not started: instance is not deployed there",
|
||||
instanceUniqueName, siteIdentifier);
|
||||
return new DebugStreamSession(sessionId, snapshot);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Debug stream {SessionId} started for {Instance} on site {Site}",
|
||||
sessionId, instanceUniqueName, siteIdentifier);
|
||||
|
||||
@@ -241,6 +254,9 @@ public class DebugStreamService : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Test/diagnostic accessor: the number of registered (attached) sessions.</summary>
|
||||
internal int SessionCount => _sessions.Count;
|
||||
|
||||
/// <summary>
|
||||
/// Sends one keepalive round to every attached session. Exposed (internal) so tests can
|
||||
/// drive the keepalive deterministically instead of waiting on the timer.
|
||||
|
||||
Reference in New Issue
Block a user