Options for connect()
do not work as intended
#645
Labels
defect
Suspected defect such as a bug or regression
connect()
do not work as intended
#645
Observed behavior
Hi!
While working on a project with nats I noticed that something doesn't work as intended (or at least how I understand it). I wanted to use
nats.connect()
without reconnects on startup (try once and fail), however, I wasn't able to achieve it. My test code for that was more or less a mesh-up from different parts of the official python client documentation. Strangely enough,connect_timeout
didn't seem to have an effect either, onlyerror_cb
did (I was able to get notified on connection errors). The following code should reproduce this behaviour:I hope you will be able to help me or at least point me to the right direction. I also noticed that the documentation on these parameters is sparse (#600 seems to try to fix that though), but I feel that after reading this and this and manually inspecting the source code, the code above should fail after 1 second. If I misunderstood anything, please let me know :)
Expected behavior
I want the code to throw an unhandled exception which can be handled manually, later. Additionally I expect the code to take only 1 sec to fail instead of the default 2 sec.
This all can be useful to notify a testing client about the failed connection attempt for instance.
Server and client version
nats-server is not available as the client is intended to fail
pip show nats-py
shows: Version: 2.9.0Host environment
Running on Windows 10 Host in WSL - Ubuntu 24.04 - Python 3.12.
Steps to reproduce
See script above with the specified dependencies.
The text was updated successfully, but these errors were encountered: