Rename "retries" to "attempts"

Otherwise, semantically, it's off-by-one.
This commit is contained in:
Derek Arnold
2024-09-15 12:03:51 -05:00
parent aa74db46cb
commit 9e7d5e96ab
2 changed files with 5 additions and 5 deletions

View File

@@ -275,7 +275,7 @@ def onConnected(interface):
# convenient place to store any keyword args we pass to getNode
getNode_kwargs = {
"requestChannelRetries": args.channel_fetch_retries,
"requestChannelRetries": args.channel_fetch_attempts,
"timeout": args.timeout
}
@@ -1416,7 +1416,7 @@ def initParser():
)
group.add_argument(
"--channel-fetch-retries",
"--channel-fetch-attempts",
help=("Attempt to retrieve channel settings for --ch-set this many times before giving up."),
default=3,
type=int,

View File

@@ -315,7 +315,7 @@ class MeshInterface: # pylint: disable=R0902
return table
def getNode(
self, nodeId: str, requestChannels: bool = True, requestChannelRetries: int = 3, timeout: int = 300
self, nodeId: str, requestChannels: bool = True, requestChannelAttempts: int = 3, timeout: int = 300
) -> meshtastic.node.Node:
"""Return a node object which contains device settings and channel info"""
if nodeId in (LOCAL_ADDR, BROADCAST_ADDR):
@@ -326,7 +326,7 @@ class MeshInterface: # pylint: disable=R0902
if requestChannels:
logging.debug("About to requestChannels")
n.requestChannels()
retries_left = requestChannelRetries
retries_left = requestChannelAttempts
last_index: int = 0
while retries_left > 0:
retries_left -= 1
@@ -334,7 +334,7 @@ class MeshInterface: # pylint: disable=R0902
new_index: int = len(n.partialChannels) if n.partialChannels else 0
# each time we get a new channel, reset the counter
if new_index != last_index:
retries_left = requestChannelRetries - 1
retries_left = requestChannelAttempts - 1
if retries_left <= 0:
our_exit(f"Error: Timed out waiting for channels, giving up")
print("Timed out trying to retrieve channel info, retrying")