-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Retrying connecting Influxdb at setup #22567
Conversation
Hello @scornelissen85, When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es). The commits that are missing a linked GitHub account are the following:
Unfortunately, we are unable to accept this pull request until this situation is corrected. Here are your options:
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community. Thanks, I look forward to checking this PR again soon! ❤️ |
df53634
to
4a8da64
Compare
Hi @scornelissen85, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
@amelchio is right, sorry |
Since this is not an entity platform, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello and welcome 😀. This approach is unfortunately not acceptable.
In the except handler, you can use homeassistant.helpers.event.call_later()
to schedule another setup()
something like one minute later and then just return True
Let me know if you need help with that :)
except (exceptions.InfluxDBClientError, IOError, | ||
requests.exceptions.ConnectionError) as exc: | ||
if retry < max_tries: | ||
time.sleep(RETRY_DELAY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not yet on the InfluxThread
, so we are not allowed to sleep here (since it blocks other tasks from using this thread).
Thanks for your input. I will change it to using Should I made a new PR? |
That is up to you, feel free to keep pushing to this one. |
_LOGGER.warning("Database host is not accessible due to '%s', please " | ||
"check your entries in the configuration file (host, " | ||
"port, etc.) and verify that the database exists and is " | ||
"READ/WRITE. Retrying again in %s sec.", exc, RETRY_INTERVAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (85 > 79 characters)
return False | ||
_LOGGER.warning("Database host is not accessible due to '%s', please " | ||
"check your entries in the configuration file (host, " | ||
"port, etc.) and verify that the database exists and is " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (81 > 79 characters)
@@ -39,6 +39,7 @@ | |||
TIMEOUT = 5 | |||
RETRY_DELAY = 20 | |||
QUEUE_BACKLOG_SECONDS = 30 | |||
RETRY_INTERVAL = 60 # seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least two spaces before inline comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is better 👍. Just a couple of small comments.
) | ||
event_helper.call_later( | ||
hass, RETRY_INTERVAL, lambda _: setup(hass, config) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should return True
here or the code below will create a new thread for each retry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it by my latest commit
"Database host is not accessible due to '%s', please " | ||
"check your entries in the configuration file (host, " | ||
"port, etc.) and verify that the database exists and is " | ||
"READ/WRITE. Retrying again in %s sec.", exc, RETRY_INTERVAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please type out "seconds"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it by my latest commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Just a small question, maybe more general about the release process. When will this PR being released in stable Home Assistant? |
April 17th. There is a release every two weeks and before that you must spend a week in beta. You missed the previous beta by a few days. This PR will be in the beta that ships about two days from now and it will be in stable a week after that (releases are in the middle of the week, usually Wednesday). |
Thanks |
Description:
This change makes the Influxdb setup more robust. I had the issue that Influxdb itself started slower than Home-Assistant, even with max_retries set That resulted in a not functioning Influxdb component. I thought max_retries should fix this, but I saw that setting max_retries only affects at the moment of writing to Influxdb, not in
setup()
. With this change, the max_retries is also used at setup time.There is no config change with current change.