-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix no auto reconnect after close/connect in TCPclient #1298
Conversation
Co-authored-by: jan iversen <jancasacondor@gmail.com>
Please also solve the CI errors. |
The stuff lint was complaining about should be OK
connect() now overwrites delay_ms with the default in params (that solved the bug breaking reconnects after close()). So it overwrites the value set to "5000" and fails this test. I'm not sure what to do here, because it's up to you to decide if client.delay_ms is an API that should be writable by the user or not. Although I think it makes little sense to have it writable because the reconnect functions in the client modify the value to increase the interval between reconnects, and it is reset to the default value from params after a successful connection. So if the user writes something to it, it'll be short lived anyway... |
delay_ms is not part of the API, but in many of the tests are allowed to use internal values. Please correct the tests, maybe the tests should simply use the timeout parameter. Please remember some of the tests are very old, so changing them is quite ok even removing some might be ok. When doing the final review, I will be extra careful when looking at the test changes. |
Done, looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
Seems there are a problem with python 3.11, I have restarted the job to see if it is a real error. |
…1298) fix no auto reconnect after close/connect in TCPclient Co-authored-by: jan iversen <jancasacondor@gmail.com>
Greetings,
AsyncModbusTcpClient.close() followed by connect() to reuse the object left it unable to auto-reconnect because delay_ms was set to 0 in close() but not reset to default setting in connect().
Added canceling of auto-reconnect background task in close().
Added check to avoid launching more than one auto-reconnect task in case user calls connect() too many times.
fixes #1198