Skip to content
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

Retry admin channel setting retrieval and add configurable timeout #665

Merged
merged 15 commits into from
Sep 18, 2024

Conversation

lysol
Copy link
Contributor

@lysol lysol commented Sep 4, 2024

Couple things I noticed while working with the admin channel with the Python CLI:

  • If one request for a channel times out, it's a real bummer, because we have to start over. These changes make it so if there's a timeout, the same request is retried up to a user-configurable number of times that defaults to 3.
  • The default timeout for this is 300 seconds, or 5 minutes, which is pretty long. In my experience, if you don't hear back inside of 20 seconds, it's not going to come at all. I made it user-configurable, but maybe dropping it to 30 seconds or something is better, because the changes here are kind of complex for just managing a timeout.

I'm not 100% on the wording of the help messages -- it's not my strong suit. I've tested these changes manually, but didn't make any changes to tests and added (hopefully enough) test coverage. I feel reasonably confident about the changes, but the changes add complexity that wasn't there.

I'll note that in 2.5.x, the admin channel, especially with channel info retrieval, seems to be a lot more reliable, so this might be a lot more complexity that could be unnecessary. If you think that's the case, I think just customizing the timeout might be nice, since five minutes is a pretty long period of time.

Copy link
Contributor

@ianmcorvidae ianmcorvidae left a comment

Choose a reason for hiding this comment

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

I think I like your thinking here in general. Got a couple comments/recommendations to get CI a bit happier, hopefully.

meshtastic/__main__.py Outdated Show resolved Hide resolved
meshtastic/mesh_interface.py Outdated Show resolved Hide resolved
meshtastic/node.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 15, 2024

Codecov Report

Attention: Patch coverage is 63.76812% with 25 lines in your changes missing coverage. Please review.

Project coverage is 60.95%. Comparing base (584a14f) to head (2026212).
Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
meshtastic/__main__.py 45.45% 24 Missing ⚠️
meshtastic/mesh_interface.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #665      +/-   ##
==========================================
+ Coverage   60.70%   60.95%   +0.25%     
==========================================
  Files          24       24              
  Lines        3667     3683      +16     
==========================================
+ Hits         2226     2245      +19     
+ Misses       1441     1438       -3     
Flag Coverage Δ
unittests 60.95% <63.76%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Otherwise, semantically, it's off-by-one.
For example, 0x0 will generate an unhandled ValueError. This was caught
during a random unit test run for 3.9, so I figure I'd fix it.

This is unrelated to the PR otherwise.
@@ -82,7 +82,7 @@ def fromStr(valstr):
val = bytes()
elif valstr.startswith("0x"):
# if needed convert to string with asBytes.decode('utf-8')
val = bytes.fromhex(valstr[2:])
val = bytes.fromhex(valstr[2:].zfill(2))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this because fromStr failed on 0x0 as fuzzed input. This is unrelated to the other changes, so I can pull this out if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Glad to accept some test fixes alongside other stuff, so no worries there for sure!

@lysol
Copy link
Contributor Author

lysol commented Sep 15, 2024

Thanks @ianmcorvidae for the hints on the CI failures -- made it easy to get familiar with the CI stack on this repo.

@lysol lysol marked this pull request as ready for review September 15, 2024 22:10
Copy link
Contributor

@ianmcorvidae ianmcorvidae left a comment

Choose a reason for hiding this comment

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

I think this looks good to bring in. Thanks for the updates! I know you mentioned in Discord that you've been having fewer issues with 2.5, which is great, but I'm sure this'll still be valuable.

@@ -82,7 +82,7 @@ def fromStr(valstr):
val = bytes()
elif valstr.startswith("0x"):
# if needed convert to string with asBytes.decode('utf-8')
val = bytes.fromhex(valstr[2:])
val = bytes.fromhex(valstr[2:].zfill(2))
Copy link
Contributor

Choose a reason for hiding this comment

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

Glad to accept some test fixes alongside other stuff, so no worries there for sure!

@ianmcorvidae ianmcorvidae merged commit 951edfe into meshtastic:master Sep 18, 2024
11 checks passed
@lysol lysol deleted the remote-admin-retry branch September 20, 2024 00:45
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