fix(galaxy): invalidate writer handle caches on session reconnect

Add IGalaxyDataWriter.InvalidateHandleCaches() and call it in
GalaxyDriver.ReopenAsync after RecreateAsync succeeds. Prior to this
fix, GatewayGalaxyDataWriter's _itemHandles and _supervisedHandles
dictionaries survived across reconnects, causing the next write to
skip AddItem and AdviseSupervisory against already-dead handles.
This commit is contained in:
Joseph Doherty
2026-06-14 00:39:24 -04:00
parent 42b4a923fd
commit f77488eed9
7 changed files with 144 additions and 0 deletions
@@ -293,6 +293,9 @@ public sealed class GalaxyDriver
if (_ownedMxSession is null) return;
var clientOptions = BuildClientOptions(_options.Gateway);
await _ownedMxSession.RecreateAsync(clientOptions, cancellationToken).ConfigureAwait(false);
// The recreated session invalidates every prior gw item handle; drop the writer's handle/advise
// caches so the next write re-AddItems + re-AdviseSupervisory against the fresh session.
_dataWriter?.InvalidateHandleCaches();
}
/// <summary>