feat(battle-node): clear RealParticipant outbound archive on session terminate
Closes audit Md11. BattleSession.RunAsync now clears each RealParticipant.Outbound archive immediately before the TerminateAsync cascade, releasing the heavy dict the moment the battle ends instead of waiting for the participant to be GC'd. Bots (NoOp / Scripted) don't expose an OutboundSequencer, so the 'p is RealParticipant rp' conditional cast is the natural filter. Tests: 1 new BattleSessionTerminateCascadeTests — pre-load the archive, drive RunAsync to completion via TestWebSocket.CompleteIncoming, assert the archive is empty. Suite: 939 → 948. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,13 @@ public sealed class BattleSession
|
||||
catch { /* swallow */ }
|
||||
}
|
||||
|
||||
// Audit Md11 — release per-participant outbound archives at battle-end
|
||||
// (only RealParticipant has one; bots don't archive). Heavy state is
|
||||
// dropped synchronously here so the participant's TerminateAsync doesn't
|
||||
// need to keep the dict alive through its disposal handshake.
|
||||
if (A is RealParticipant rpA) rpA.Outbound.Clear();
|
||||
if (B is RealParticipant rpB) rpB.Outbound.Clear();
|
||||
|
||||
await Task.WhenAll(
|
||||
A.TerminateAsync(BattleFinishReason.NormalFinish),
|
||||
B.TerminateAsync(BattleFinishReason.NormalFinish))
|
||||
|
||||
Reference in New Issue
Block a user