Skip to content

Commit 50034c9

Browse files
authored
Merge pull request #196 from blackstorm/lee/connect-pending-size-option
Support set pending size to client connect options
2 parents 045f7bf + 4c48f90 commit 50034c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nats/aio/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ async def connect(
248248
max_outstanding_pings=DEFAULT_MAX_OUTSTANDING_PINGS,
249249
dont_randomize=False,
250250
flusher_queue_size=DEFAULT_MAX_FLUSHER_QUEUE_SIZE,
251+
pending_size=DEFAULT_PENDING_SIZE,
251252
no_echo=False,
252253
tls=None,
253254
tls_hostname=None,
@@ -295,6 +296,7 @@ async def connect(
295296
self.options["token"] = token
296297
self.options["connect_timeout"] = connect_timeout
297298
self.options["drain_timeout"] = drain_timeout
299+
self.options["pending_size"] = pending_size
298300

299301
if tls:
300302
self.options['tls'] = tls
@@ -1096,7 +1098,7 @@ async def _send_command(self, cmd, priority=False):
10961098
else:
10971099
self._pending.append(cmd)
10981100
self._pending_data_size += len(cmd)
1099-
if self._pending_data_size > DEFAULT_PENDING_SIZE:
1101+
if self._pending_data_size > self.options["pending_size"]:
11001102
await self._flush_pending()
11011103

11021104
async def _flush_pending(self):

0 commit comments

Comments
 (0)