Skip to content

Commit f6a9d07

Browse files
authored
set max workers for threadpool to partition count (Azure#40182)
1 parent 19241b2 commit f6a9d07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sdk/eventhub/azure-eventhub/azure/eventhub/_buffered_producer/_buffered_producer_dispatcher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def __init__(
5151
self._amqp_transport = amqp_transport
5252

5353
if not executor:
54-
self._executor = ThreadPoolExecutor()
54+
# set max workers to the number of partitions & one for the close operation.
55+
max_workers: int = len(self._partition_ids) + 1
56+
self._executor = ThreadPoolExecutor(max_workers=max_workers)
5557
elif isinstance(executor, ThreadPoolExecutor):
5658
self._existing_executor = True
5759
self._executor = executor

0 commit comments

Comments
 (0)