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

Introduce exponential backoff for MQTT reconnect #263

Merged
merged 3 commits into from
Dec 5, 2024

Conversation

WebSpider
Copy link
Contributor

@WebSpider WebSpider commented Dec 4, 2024

This makes MQTT reconnect backoff exponential so we do not hammer MQTT server if it is in an error state.

Observed in todays MQTT outage that we reconnect every 5s, which is very rapid when running this distributed and at scale.
We do not need to DOS the MQTT server while trying to get our updates, so implementing an industry-standard solution (exponential backoff with jitter) to this, seems like a reasonable addition.

@WebSpider WebSpider added the bug Something isn't working label Dec 4, 2024
@WebSpider WebSpider requested review from dvx76 and Prior99 December 4, 2024 10:10
myskoda/mqtt.py Outdated Show resolved Hide resolved
@WebSpider WebSpider merged commit 1b816ac into skodaconnect:main Dec 5, 2024
1 of 2 checks passed
@WebSpider WebSpider deleted the mqtt-exponential_backoff branch December 5, 2024 21:03
zaptm pushed a commit to zaptm/myskoda that referenced this pull request Dec 8, 2024
* Make MQTT reconnect backoff exponential so we do not hammer MQTT server if it is in an error state
* Add self._reconnect_delay to init. Reset only upon succesfull complete subscribe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants