pypi nats-py 2.1.0
Release v2.1.0

latest releases: 2.9.0, 2.8.0, 2.7.2...
2 years ago

Added

  • Added pending_size option on connect to set max internal pending size for flushing commands and a flush_timeout option to control the maximum time to wait for a flush.

For example to set it to 2MB only which is the default:

nats.connect(pending_size=2*1024*1024)

And similar to the nats.go client, it can be disabled if set to be negative:

nats.connect(pending_size=-1)

When pending size is disabled, then any published message during a disconnection will result in a synchronous OutboundBufferLimitError thrown when publishing.

To control the flushing there is a flush_timeout option that can be passed on connect as well.

nats.connect(flush_timeout=10)

By default, there is no flush timeout (it is None) so the client can wait indefinitely during a flush similar to nats.go (eventually the ping interval ought to unblock the flushing). These couple of changes also improve the publishing performance of the client, thanks to @charbonnierg for contributing to this issue.

Fixed

Changed

  • Changed nc.flush() to now throw FlushTimeoutError instead which is a subtype of TimeoutError that it used be using for backwards compatibility.

  • Changed EOF disconnections being reported as StaleConnectionError and they are instead a UnexpectedEOF error.

Don't miss a new nats-py release

NewReleases is sending notifications on new releases.