in src/Elastic.Channels/BufferedChannelBase.cs [469:507]
public virtual void Dispose()
{
try
{
// Mark inchannel completed to flush buffer and end task, signalling end to outchannel
InChannel.Writer.TryComplete();
// Wait a reasonable duration for the outchannel to complete before disposing the rest
if (!_exitCancelSource.IsCancellationRequested)
{
// Allow one retry before we exit
var maxwait = Options.BufferOptions.ExportBackoffPeriod(1);
_exitCancelSource.Token.WaitHandle.WaitOne(maxwait);
}
_exitCancelSource.Dispose();
InboundBuffer.Dispose();
TokenSource.Cancel();
TokenSource.Dispose();
}
catch
{
// ignored
}
try
{
_inTask.Dispose();
}
catch
{
// ignored
}
try
{
_outTask.Dispose();
}
catch
{
// ignored
}
}