pymodbus
pymodbus copied to clipboard
Simplify asyncio and server list
Note: this code is very confusing to me, so @janiversen please review carefully.
Solves another 5 mypy
errors, and speeds up the Window tests.
Instancing the class _serverList
from its own method
(1) is... strange?
(2) is unnecessary to use the methods, which are all @classmethod
(3) is unnecessary to keep track of the event loop, since every server class already has self.loop
==> Use the class methods directly
The methods shutdown()
and server_close()
are essentially redundant.
==> combine
There's no use for asyncio.wait()
directly after an await
.
==> remove
time.sleep()
is inefficient, as described in https://github.com/pymodbus-dev/pymodbus/issues/1992#issue-2128311471)
==> replace with waiting+timeout for the Future