Skip to content

exponential backoff for (re)connect #151

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
Feb 13, 2023
Merged

Conversation

vladak
Copy link
Contributor

@vladak vladak commented Feb 7, 2023

This change implements exponential back-off for connect/reconnect based on the Google IoT algorithm description (sic!), with a nuance in handling temporary errors (like name resolution errors or memory shortage). At one point I had code that applied the exponential back-off also for successfull reconnect()s, however found it a bit too complex and hand-holdy. If one calls reconnect() in a loop even after prior successful connect without sleeping in between, he probably deserves to be rate limited by the broker.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

This looks good to me to. Thank you @vladak for implementing the backoff logic.

I tested the changes successfully with a Feather ESP32-S2 TFT using the examples in this repo and adafruit.io as the server side.

@FoamyGuy FoamyGuy merged commit ffe08db into adafruit:main Feb 13, 2023
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 14, 2023
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 1.19.14 from 1.19.13:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#84 from jposada202020/updating_cartesian_widget

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 7.2.0 from 7.1.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#151 from vladak/exp_backoff_pr
  > Add upload url to release action

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.13.0 from 1.12.12:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#123 from grypoB/content-length
  > Add upload url to release action

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
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