Skip to content

Commit

Permalink
Clarify timeout= for async clients.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 14, 2024
1 parent c382ec9 commit ea4dfd0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ async def async_execute(self, request) -> ModbusResponse:
async with self._lock:
req = self.build_response(request)
self.ctx.send(packet)
if not request.slave_id:
resp = None
break
try:
resp = await asyncio.wait_for(
req, timeout=self.ctx.comm_params.timeout_connect
Expand All @@ -124,7 +121,7 @@ async def async_execute(self, request) -> ModbusResponse:
f"ERROR: No response received after {self.retries} retries"
)

return resp # type: ignore[return-value]
return resp

def build_response(self, request: ModbusRequest):
"""Return a deferred response for the current request.
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AsyncModbusSerialClient(ModbusBaseClient):
:param name: Set communication name, used in logging
:param reconnect_delay: Minimum delay in seconds.milliseconds before reconnecting.
:param reconnect_delay_max: Maximum delay in seconds.milliseconds before reconnecting.
:param timeout: Timeout for a connection request, in seconds.
:param timeout: Timeout for connecting and receiving data, in seconds.
:param retries: Max number of retries per request.
:param on_connect_callback: Function that will be called just before a connection attempt.
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ModbusTcpClient(ModbusBaseSyncClient):
:param source_address: source address of client
:param reconnect_delay: Not used in the sync client
:param reconnect_delay_max: Not used in the sync client
:param timeout: Timeout for a connection request, in seconds.
:param timeout: Timeout for connecting and receiving data, in seconds.
:param retries: Max number of retries per request.
.. tip::
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ModbusTlsClient(ModbusTcpClient):
:param source_address: Source address of client
:param reconnect_delay: Not used in the sync client
:param reconnect_delay_max: Not used in the sync client
:param timeout: Timeout for a connection request, in seconds.
:param timeout: Timeout for connecting and receiving data, in seconds.
:param retries: Max number of retries per request.
.. tip::
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AsyncModbusUdpClient(ModbusBaseClient):
:param source_address: source address of client,
:param reconnect_delay: Minimum delay in seconds.milliseconds before reconnecting.
:param reconnect_delay_max: Maximum delay in seconds.milliseconds before reconnecting.
:param timeout: Timeout for a connection request, in seconds.
:param timeout: Timeout for connecting and receiving data, in seconds.
:param retries: Max number of retries per request.
:param on_connect_callback: Function that will be called just before a connection attempt.
Expand Down

0 comments on commit ea4dfd0

Please sign in to comment.