From 398f60c3d0d04da57c7daec5d17eef76466856d3 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 13 Feb 2022 07:09:37 -0800 Subject: [PATCH] Reset the stream backoff timeout when the url updates (#66426) Reset the stream backoff timeout when the url updates, meant to improve the retry behavior for nest cameras. The problem is the nest url updates faster than the stream reset time so the wait timeout never resets if there is a temporarily problem with the new url. In particular this *may* help with the flaky cloud nest urls, but seems more correct otherwise. --- homeassistant/components/stream/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/stream/__init__.py b/homeassistant/components/stream/__init__.py index 79506c0bda2..731fd410686 100644 --- a/homeassistant/components/stream/__init__.py +++ b/homeassistant/components/stream/__init__.py @@ -342,7 +342,9 @@ class Stream: stream_state.discontinuity() if not self.keepalive or self._thread_quit.is_set(): if self._fast_restart_once: - # The stream source is updated, restart without any delay. + # The stream source is updated, restart without any delay and reset the retry + # backoff for the new url. + wait_timeout = 0 self._fast_restart_once = False self._thread_quit.clear() continue