-
Notifications
You must be signed in to change notification settings - Fork 5k
[Service Bus] Retry when throttled with short try #50394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The focus of these changes is to improve the retry logic in the Service Bus SDK when throttling occurs. Behavior has been adjusted to allow short `TryTimeout` configurations to consume retries when waiting for service throttling rather than triggering an immediate `ServiceBusy` exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the Service Bus SDK retry logic to better handle throttling when a short TryTimeout is configured. In summary, the changes include:
- Adding tests to validate retry behavior during server busy conditions.
- Refactoring the retry logic in ServiceBusRetryPolicy to loop until the busy state clears or retries are exhausted.
- Making minor code style improvements, such as marking constants as readonly.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
sdk/servicebus/Azure.Messaging.ServiceBus/tests/Primitives/ServiceBusRetryPolicyTests.cs | Added tests validating retry logic during server busy conditions using test helper classes. |
sdk/servicebus/Azure.Messaging.ServiceBus/src/Primitives/ServiceBusRetryPolicy.cs | Updated the retry loop logic to handle server busy scenarios, including recalculating try timeouts and delays. |
sdk/servicebus/Azure.Messaging.ServiceBus/src/Core/BasicRetryPolicy.cs | Changed MaximumTimeSpanSeconds to a readonly field for consistency. |
sdk/servicebus/Azure.Messaging.ServiceBus/CHANGELOG.md | Updated changelog documentation to reflect the new retry behavior. |
sdk/servicebus/Azure.Messaging.ServiceBus/tests/Primitives/ServiceBusRetryPolicyTests.cs
Show resolved
Hide resolved
sdk/servicebus/Azure.Messaging.ServiceBus/src/Primitives/ServiceBusRetryPolicy.cs
Show resolved
Hide resolved
jsquire
commented
Jun 3, 2025
christothes
approved these changes
Jun 3, 2025
/azp run net - servicebus - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
christothes
approved these changes
Jun 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The focus of these changes is to improve the retry logic in the Service Bus SDK when throttling occurs. Behavior has been adjusted to allow short
TryTimeout
configurations to consume retries when waiting for service throttling rather than triggering an immediateServiceBusy
exception.References and related