Skip to content

Commit 6af433f

Browse files
authored
[ServiceBus] Do not retry on sessionful receiver connection issue (Azure#15060)
1 parent 98c59c7 commit 6af433f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ def _handle_amqp_connection_error(logger, exception, handler):
122122
error = ServiceBusConnectionError(message, error=exception)
123123
error_need_raise, error_need_close_handler = True, False
124124

125+
# If there's connection issue happening in a sessionful receiver, we don't do retry.
126+
# Because the user has to handle more potential exceptions SessionCannotBeLocked/ServiceTimeout/SessionLockLost.
127+
try:
128+
error_need_raise = error_need_raise or (handler.session is not None)
129+
except AttributeError:
130+
pass
125131
return error, error_need_close_handler, error_need_raise
126132

127133

0 commit comments

Comments
 (0)