Skip to content

Commit bdc6c04

Browse files
authored
Set AMQP Client Link Max Message Size to 0 for ServiceBus [Eventloop Fix] (#43383)
* changing the max message size on link to 0 * minor changes to send function * fix for failing test - test_async_queue_mock_no_reusing_auto_lock_renew * removed send function ( testing) * nit change
1 parent 8cc94ab commit bdc6c04

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

eng/tools/azure-sdk-tools/devtools_testutils/azure_recorded_testcase.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ def await_prepared_test(test_fn):
161161
@functools.wraps(test_fn)
162162
def run(test_class_instance, *args, **kwargs):
163163
trim_kwargs_from_test_function(test_fn, kwargs)
164-
loop = asyncio.get_event_loop()
164+
try:
165+
loop = asyncio.get_event_loop()
166+
except RuntimeError:
167+
loop = asyncio.new_event_loop()
168+
asyncio.set_event_loop(loop)
165169
return loop.run_until_complete(test_fn(test_class_instance, **kwargs))
166170

167171
return run

sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
OUTGOING_WINDOW,
4747
DEFAULT_AUTH_TIMEOUT,
4848
MESSAGE_DELIVERY_DONE_STATES,
49+
LINK_MAX_MESSAGE_SIZE
4950
)
5051

5152
from .management_operation import ManagementOperation
@@ -576,7 +577,7 @@ class SendClient(AMQPClient):
576577
def __init__(self, hostname, target, **kwargs):
577578
self.target = target
578579
# Sender and Link settings
579-
self._max_message_size = kwargs.pop("max_message_size", MAX_FRAME_SIZE_BYTES)
580+
self._max_message_size = kwargs.pop("max_message_size", LINK_MAX_MESSAGE_SIZE)
580581
self._link_properties = kwargs.pop("link_properties", None)
581582
self._link_credit = kwargs.pop("link_credit", None)
582583
super(SendClient, self).__init__(hostname, **kwargs)

sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#: size until they have agreed a definitive maximum frame size for that Connection.
6060
MIN_MAX_FRAME_SIZE = 512
6161
MAX_FRAME_SIZE_BYTES = 1024 * 1024
62+
LINK_MAX_MESSAGE_SIZE = 0
6263
MAX_CHANNELS = 65535
6364
INCOMING_WINDOW = 64 * 1024
6465
OUTGOING_WINDOW = 64 * 1024

0 commit comments

Comments
 (0)