1
0
mirror of synced 2024-11-22 01:13:49 +00:00

Fixed Flow response messages blocking the consumer

Caused by non-async disposable payload in MessageContext never being disposed
This commit is contained in:
Mark van Renswoude 2021-09-16 12:26:11 +02:00
parent 04182ad9bd
commit a9a38f2497
2 changed files with 11 additions and 11 deletions

View File

@ -8,7 +8,7 @@ namespace Tapeti.Config
/// <summary> /// <summary>
/// Provides information about the message currently being handled. /// Provides information about the message currently being handled.
/// </summary> /// </summary>
public interface IMessageContext : IAsyncDisposable, IDisposable public interface IMessageContext : IAsyncDisposable
{ {
/// <summary> /// <summary>
/// Provides access to the Tapeti config. /// Provides access to the Tapeti config.

View File

@ -66,21 +66,21 @@ namespace Tapeti.Default
} }
/// <inheritdoc />
public void Dispose()
{
foreach (var payload in payloads.Values)
(payload as IDisposable)?.Dispose();
}
/// <inheritdoc /> /// <inheritdoc />
public async ValueTask DisposeAsync() public async ValueTask DisposeAsync()
{ {
foreach (var payload in payloads.Values) foreach (var payload in payloads.Values)
{ {
if (payload is IAsyncDisposable asyncDisposable) switch (payload)
{
case IAsyncDisposable asyncDisposable:
await asyncDisposable.DisposeAsync(); await asyncDisposable.DisposeAsync();
break;
case IDisposable disposable:
disposable.Dispose();
break;
}
} }
} }