Skip to content

Add retries to ModbusPDU class #2672

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

Merged
merged 1 commit into from
May 23, 2025

Conversation

mdeneen
Copy link
Contributor

@mdeneen mdeneen commented May 22, 2025

I tried doing this before by adding another return value, but it would break many things.

This time I have added an integer representing the number of retries to the ModbusPDU class and setting that value in both the async and sync transaction execute code path.

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@janiversen janiversen merged commit 59fc0e2 into pymodbus-dev:dev May 23, 2025
16 checks passed
@mdeneen
Copy link
Contributor Author

mdeneen commented May 23, 2025

Hey, Jan, one downside to this is that if you enable logging it will show retries as zero with the string representation of the PDU, since the decoder action happens before the retry is set.

@janiversen
Copy link
Collaborator

I actually considered asking not to include it in the string representation. Feel free to submit a PR.

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

Successfully merging this pull request may close these issues.

2 participants