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

More reliable DB reconnection logic #106

Open
dankeder opened this issue Jul 6, 2023 · 1 comment
Open

More reliable DB reconnection logic #106

dankeder opened this issue Jul 6, 2023 · 1 comment

Comments

@dankeder
Copy link

dankeder commented Jul 6, 2023

When the TimescaleDB is unavailable while ltss is running / being started, it's retrying to reconnect 10 times with 3s delay, as seen here: https://github.com/freol35241/ltss/blob/master/custom_components/ltss/__init__.py#L125

After 30s it gives up and won't start writing data even if the DB becomes healthy in the meantime. This means that I have to babysit LTSS when I'm doing some DB maintenance and if I don't notice that it's down it leaves me with big gaps in the data.

It would be better if LTSS was retrying to reconnect indefinitely (while logging the problem if it cannot connect), or at least if the number of retries was configurable (all the way to infinity).

I can help with the PR, just let me know if you are interested in this kind of change.

Thank you for your hard work.

@freol35241
Copy link
Owner

Hi, and thanks for raising this issue.

First, you "should" only see this specific behavior when LTSS is being started while the database is not available, whereas reconnection attempts should happen automatically for the case where the database goes offline while LTSS is running and then comes online again (regardless of the time it was offline). Can you please confirm this? Please note that data will be dropped while the database is offline.

Please feel free to submit a PR that covers the case where LTSS (HA) is (re-)started at a time when the database is offline.

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

No branches or pull requests

2 participants