From fde278228dc7c52e48ea27f732e2b2e23ab1fd33 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 6 Apr 2023 07:44:45 +0200 Subject: [PATCH] Prevent possible concurrency issues in ParallelRequestBuilder --- Tapeti.Flow/Default/FlowProvider.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Tapeti.Flow/Default/FlowProvider.cs b/Tapeti.Flow/Default/FlowProvider.cs index 0ef8aa3..91ffb39 100644 --- a/Tapeti.Flow/Default/FlowProvider.cs +++ b/Tapeti.Flow/Default/FlowProvider.cs @@ -407,14 +407,16 @@ namespace Tapeti.Flow.Default if (convergeMethod.Method.DeclaringType != context.HandlerContext.Controller?.GetType()) throw new YieldPointException("Converge method must be in the same controller class"); - await Task.WhenAll(requests.Select(requestInfo => - flowProvider.SendRequest( - context, + foreach (var requestInfo in requests) + { + await flowProvider.SendRequest( + context, requestInfo.Message, requestInfo.ResponseHandlerInfo, convergeMethod.Method.Name, convergeMethodSync, - false))); + false); + } await context.Store(requests.Any(i => i.ResponseHandlerInfo.IsDurableQueue)); });