fix(sessions): close SessionEventDistributor dispose/register races + add overflow logging

This commit is contained in:
Joseph Doherty
2026-06-15 12:37:39 -04:00
parent c79b292968
commit 7773bdebbd
2 changed files with 81 additions and 27 deletions
@@ -100,6 +100,18 @@ public sealed class SessionEventDistributorTests
await AssertCompletedAsync(leaseB.Reader);
}
[Fact]
public async Task Register_AfterDispose_ThrowsObjectDisposedException()
{
Channel<MxEvent> source = Channel.CreateUnbounded<MxEvent>();
SessionEventDistributor distributor = CreateDistributor(source.Reader);
await distributor.StartAsync(CancellationToken.None);
await distributor.DisposeAsync().AsTask().WaitAsync(ReadTimeout);
Assert.Throws<ObjectDisposedException>(() => distributor.Register());
}
private static SessionEventDistributor CreateDistributor(ChannelReader<MxEvent> source)
=> new(
"session-test",