Skip to content

Commit 42f3fc9

Browse files
authored
[ServiceBus] retry amqp exception if not non-retry condition (Azure#23980)
* make amqp condition exceptions retryable unless o/w specified * changelog * retry if not non-retry condition * update changelog * update verson * add error test * nit
1 parent 405245a commit 42f3fc9

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

sdk/servicebus/azure-servicebus/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 7.6.2 (Unreleased)
4+
5+
### Bugs Fixed
6+
7+
- Fixed bug to make AMQP exceptions retryable by default, if condition is not non-retryable, to ensure that InternalServerErrors are retried.
8+
39
## 7.6.1 (2022-04-11)
410

511
### Other Changes

sdk/servicebus/azure-servicebus/azure/servicebus/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55

6-
VERSION = "7.6.1"
6+
VERSION = "7.6.2"

sdk/servicebus/azure-servicebus/azure/servicebus/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def _handle_amqp_exception_with_condition(
115115
)
116116
if condition in _NO_RETRY_CONDITION_ERROR_CODES:
117117
error._retryable = False # pylint: disable=protected-access
118+
else:
119+
error._retryable = True # pylint: disable=protected-access
118120

119121
return error
120122

sdk/servicebus/azure-servicebus/tests/livetest/test_errors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ def test_unknown_connection_error():
3131
assert isinstance(sb_error,ServiceBusError)
3232
assert not sb_error._retryable
3333
assert sb_error._shutdown_handler
34+
35+
def test_internal_server_error():
36+
logger = logging.getLogger("testlogger")
37+
amqp_error = AMQPErrors.LinkDetach(
38+
description="The service was unable to process the request; please retry the operation.",
39+
condition=AMQPConstants.ErrorCodes.InternalServerError
40+
)
41+
sb_error = _create_servicebus_exception(logger, amqp_error)
42+
assert isinstance(sb_error, ServiceBusError)
43+
assert sb_error._retryable
44+
assert sb_error._shutdown_handler

0 commit comments

Comments
 (0)