From c78e88aa3d1376adfbb5f089ac5715e81b706a9e Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Mon, 14 Oct 2024 11:12:46 +0100 Subject: [PATCH] Run continuations synchronously --- src/LocalSqsSnsMessaging/SnsClient/InMemorySnsClient.cs | 8 ++++---- src/LocalSqsSnsMessaging/SqsClient/InMemorySqsClient.cs | 4 ++-- .../SqsReceiveMessageAsyncTestsLocalAwsMessaging.cs | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/LocalSqsSnsMessaging/SnsClient/InMemorySnsClient.cs b/src/LocalSqsSnsMessaging/SnsClient/InMemorySnsClient.cs index 5b23a7b..a9b623e 100644 --- a/src/LocalSqsSnsMessaging/SnsClient/InMemorySnsClient.cs +++ b/src/LocalSqsSnsMessaging/SnsClient/InMemorySnsClient.cs @@ -40,7 +40,7 @@ public async Task SubscribeQueueAsync(string topicArn, ICoreAmazonSQS sq ArgumentNullException.ThrowIfNull(sqsClient); // Get the queue's existing policy - var queueAttributes = await sqsClient.GetAttributesAsync(sqsQueueUrl).ConfigureAwait(false); + var queueAttributes = await sqsClient.GetAttributesAsync(sqsQueueUrl).ConfigureAwait(true); var sqsQueueArn = queueAttributes["QueueArn"]; @@ -61,10 +61,10 @@ public async Task SubscribeQueueAsync(string topicArn, ICoreAmazonSQS sq TopicArn = topicArn, Protocol = "sqs", Endpoint = sqsQueueArn, - }).ConfigureAwait(false); + }).ConfigureAwait(true); var setAttributes = new Dictionary { { "Policy", policy.ToJson() } }; - await sqsClient.SetAttributesAsync(sqsQueueUrl, setAttributes).ConfigureAwait(false); + await sqsClient.SetAttributesAsync(sqsQueueUrl, setAttributes).ConfigureAwait(true); return response.SubscriptionArn; } @@ -77,7 +77,7 @@ public async Task> SubscribeQueueToTopicsAsync(IList Dictionary topicSubscriptionMapping = new(); foreach (var topicArn in topicArns) { - var subscriptionArn = await SubscribeQueueAsync(topicArn, sqsClient, sqsQueueUrl).ConfigureAwait(false); + var subscriptionArn = await SubscribeQueueAsync(topicArn, sqsClient, sqsQueueUrl).ConfigureAwait(true); topicSubscriptionMapping.Add(topicArn, subscriptionArn); } diff --git a/src/LocalSqsSnsMessaging/SqsClient/InMemorySqsClient.cs b/src/LocalSqsSnsMessaging/SqsClient/InMemorySqsClient.cs index 8bffd63..41112cd 100644 --- a/src/LocalSqsSnsMessaging/SqsClient/InMemorySqsClient.cs +++ b/src/LocalSqsSnsMessaging/SqsClient/InMemorySqsClient.cs @@ -307,7 +307,7 @@ public async Task ReceiveMessageAsync(ReceiveMessageRequ try { - await reader.WaitToReadAsync(linkedToken.Token).ConfigureAwait(false); + await reader.WaitToReadAsync(linkedToken.Token).ConfigureAwait(true); } catch (OperationCanceledException) { @@ -562,7 +562,7 @@ private static Message CreateMessage(string messageBody, Dictionary