Skip to content

Commit

Permalink
Merge pull request #196 from blackstorm/lee/connect-pending-size-option
Browse files Browse the repository at this point in the history
Support set pending size to client connect options
  • Loading branch information
wallyqs authored Feb 25, 2021
2 parents 045f7bf + 4c48f90 commit 50034c9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nats/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ async def connect(
max_outstanding_pings=DEFAULT_MAX_OUTSTANDING_PINGS,
dont_randomize=False,
flusher_queue_size=DEFAULT_MAX_FLUSHER_QUEUE_SIZE,
pending_size=DEFAULT_PENDING_SIZE,
no_echo=False,
tls=None,
tls_hostname=None,
Expand Down Expand Up @@ -295,6 +296,7 @@ async def connect(
self.options["token"] = token
self.options["connect_timeout"] = connect_timeout
self.options["drain_timeout"] = drain_timeout
self.options["pending_size"] = pending_size

if tls:
self.options['tls'] = tls
Expand Down Expand Up @@ -1096,7 +1098,7 @@ async def _send_command(self, cmd, priority=False):
else:
self._pending.append(cmd)
self._pending_data_size += len(cmd)
if self._pending_data_size > DEFAULT_PENDING_SIZE:
if self._pending_data_size > self.options["pending_size"]:
await self._flush_pending()

async def _flush_pending(self):
Expand Down

0 comments on commit 50034c9

Please sign in to comment.