Azure / azure-service-bus-dotnet

☁️ .NET Standard client library for Azure Service Bus
https://azure.microsoft.com/services/service-bus
Other
235 stars 120 forks source link

Do not retry when there's an ambient transaction #621

Closed SeanFeldman closed 5 years ago

SeanFeldman commented 5 years ago

Fixes #615

Fix is following recommendation made on the issue:

The RetryPolicy should understand whether the operation is within a transaction scope or not. If it is, it should never retry. And this should be documented properly.

TODO

SeanFeldman commented 5 years ago

ReceiveAndDelete tests are flaky imo.

E.g. QueueClientTests.ReceiveDeleteTest is failing. It's supposed to send 10 messages and receive back 10. The way it's implemented is using TestUtility.ReceiveMessagesAsync(count). Internally, this method is running a tight loop of 5 attempts to receive all messages from an entity. Problem with this approach is that tight loop might be too fast for the broker to return all messages, resulting in a flaky tests, failing due to incorrect number of messages returned. For the test verification, I'll add a delay between attempts to see if that helps.

SeanFeldman commented 5 years ago

Green and ready.