Skip to content

Commit

Permalink
improve retries.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 14, 2024
1 parent ea4dfd0 commit ddb3c55
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pymodbus/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ def execute(self, request: ModbusPDU): # noqa: C901
if request.slave_id not in self._no_response_devices:
self._no_response_devices.append(request.slave_id)
# No response received and retries not enabled
break
if (pdu := self.client.framer.processIncomingFrame(response)):
self.addTransaction(pdu)
if (pdu := self.client.framer.processIncomingFrame(response)):
self.addTransaction(pdu)
break
Log.debug("Retrying receive, {} retries left", retries)
retries -= 1
if not (response := self.getTransaction(request.transaction_id)):
if len(self.transactions):
response = self.getTransaction(tid=0)
Expand Down

0 comments on commit ddb3c55

Please # to comment.