Add retries when creating boto3 client #33
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #12
This diff adds a retry loop when we attempt to create the boto3 client
client
.Also creates a new
amazon_rekognition
config optionboto_retries
which is optional and defaults to5
retries.I'm currently using this patch in my home setup.
Here's the dev testing that was done:
boto_retries: 0
(equivalent to how things worked before this diff).With
boto_retries
set to0
, restarted HA until boto3.client() failed and exception was thrown. Output of Dev Tools > Logs is what we expect:boto_retries
omitted from theamazon_rekognition
config: Logging at leveldebug
shows boto_retries is5
(the default).Restarted HA until a boto3.client() failure was encountered and retry was successful (boto_retries=5):
Same test but with logging level set to
debug
. One camera was configured withboto_retries: 4
, rest did not have aboto_retries
yaml line: