Skip to content

Conversation

hexbabe
Copy link
Member

@hexbabe hexbabe commented Sep 1, 2023

https://viam.atlassian.net/browse/RSDK-3961

Part of the webhook functionality with ESP32s involves the use of set_power_mode(PowerMode.POWER_MODE_OFFLINE_DEEP).

When an ESP32 is in deep sleep, it is essentially off , and will therefore not be able to respond to the SDK. This means the SDK connection will time out on a success, resulting in an error.

While the user does have control over the sdk client’s retry interval, they don’t have control over how many times a re-connect is attempted. This means that the user can’t determine how long (retry_interval x num_retries) this unnecessary reconnection attempt may live, and therefore can’t control the upper limit on network or compute utilization.

In dial options, add max_reconnect_attempts

I added the above attribute and fixed the infinite loop in _check_connection

@hexbabe hexbabe requested a review from a team as a code owner September 1, 2023 15:09
# Failure to grab resources could be for spurious, non-networking reasons. Try three times just to be safe.
connection_error = None
for attempt in range(3):
for _ in range(3):
Copy link
Member Author

@hexbabe hexbabe Sep 1, 2023

Choose a reason for hiding this comment

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

I revised this to mirror the loop structures since this attempt iterator is unused anyways

@viamrobotics viamrobotics deleted a comment from CLAassistant Sep 1, 2023
@hexbabe hexbabe changed the title RSDK-3961: Add max_reconnect_attempts to Python SDK RSDK-3961: Add max_reconnect_attempts Sep 1, 2023
@CLAassistant
Copy link

CLAassistant commented Sep 1, 2023

CLA assistant check
All committers have signed the CLA.

@hexbabe
Copy link
Member Author

hexbabe commented Sep 1, 2023

Actually, how should we test this? Is it necessary to get a micro-RDK set up with a ESP32 and recreate Matt's conditions

…onnect limiting based on said attr in client.py
Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

Minor comment that can be quickly addressed and then this can be merged!

@hexbabe hexbabe merged commit 3017edb into viamrobotics:main Sep 13, 2023
@hexbabe hexbabe deleted the RSDK-3961 branch September 13, 2023 16:33
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.

3 participants