Fixed Flow response messages blocking the consumer
Caused by non-async disposable payload in MessageContext never being disposed
This commit is contained in:
parent
04182ad9bd
commit
a9a38f2497
@ -8,7 +8,7 @@ namespace Tapeti.Config
|
||||
/// <summary>
|
||||
/// Provides information about the message currently being handled.
|
||||
/// </summary>
|
||||
public interface IMessageContext : IAsyncDisposable, IDisposable
|
||||
public interface IMessageContext : IAsyncDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the Tapeti config.
|
||||
|
@ -66,21 +66,21 @@ namespace Tapeti.Default
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var payload in payloads.Values)
|
||||
(payload as IDisposable)?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
foreach (var payload in payloads.Values)
|
||||
{
|
||||
if (payload is IAsyncDisposable asyncDisposable)
|
||||
await asyncDisposable.DisposeAsync();
|
||||
switch (payload)
|
||||
{
|
||||
case IAsyncDisposable asyncDisposable:
|
||||
await asyncDisposable.DisposeAsync();
|
||||
break;
|
||||
|
||||
case IDisposable disposable:
|
||||
disposable.Dispose();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user