From fb6aa198849039735ea0eb3aab789fd8b0f26cb4 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 9 Sep 2021 15:11:44 +0200 Subject: [PATCH] Fixed exception in Tapeti.Transient when message arrives after the timeout --- Tapeti.Transient/TransientRouter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tapeti.Transient/TransientRouter.cs b/Tapeti.Transient/TransientRouter.cs index c6a79d6..2aeea29 100644 --- a/Tapeti.Transient/TransientRouter.cs +++ b/Tapeti.Transient/TransientRouter.cs @@ -42,7 +42,7 @@ namespace Tapeti.Transient return; if (map.TryRemove(continuationID, out var tcs)) - tcs.SetResult(context.Message); + tcs.TrySetResult(context.Message); } @@ -86,7 +86,7 @@ namespace Tapeti.Transient private void TimeoutResponse(object tcs) { - ((TaskCompletionSource)tcs).SetException(new TimeoutException("Transient RequestResponse timed out at (ms) " + defaultTimeoutMs)); + ((TaskCompletionSource)tcs).TrySetException(new TimeoutException("Transient RequestResponse timed out at (ms) " + defaultTimeoutMs)); } } } \ No newline at end of file