Skip to content

Call to asyncio.sleep in ModbusBaseClient.connect slows frequent connections #2667

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

Closed
snorfalorpagus opened this issue May 11, 2025 · 1 comment

Comments

@snorfalorpagus
Copy link

#2529 added a call to await asyncio.sleep(0.1) to the connect method of ModbusBaseClient. This is causing a significant increase in the time it takes to run the test suite for an application that creates a new server and client in each test (+1 second per 10 tests). Is there a reason for this line or was it left over from some debugging?

https://github.com/pymodbus-dev/pymodbus/pull/2529/files#diff-a3d2fee1960ff928b8c5a01044d31ce619ecc6073db11c3aac8734737a8afc0fR62

@janiversen
Copy link
Collaborator

Yes there is a reason, it was not stable without it, due to task scheduling. And compared to the actual connection time 0,1 second is not very relevant.

The pymodbus have 1000+ test cases, and a lot of them with a server involved, and still running all takes around 3 minutes.

Anyhow if you want changes, then pull requests are welcome.

@janiversen janiversen closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants