From fa990de0c7fe6f050acfad3d647c1070efb069bc Mon Sep 17 00:00:00 2001 From: chemelli74 Date: Sun, 28 Feb 2021 21:20:12 +0000 Subject: [PATCH 1/2] Limit log spam --- homeassistant/config_entries.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index dbc0dd0145436..ae920a6cef8cb 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -259,12 +259,20 @@ async def async_setup( self.state = ENTRY_STATE_SETUP_RETRY wait_time = 2 ** min(tries, 4) * 5 tries += 1 - _LOGGER.warning( - "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds", - self.title, - self.domain, - wait_time, - ) + if wait_time < 80: + _LOGGER.warning( + "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds", + self.title, + self.domain, + wait_time, + ) + elif wait_time == 80: + _LOGGER.warning( + "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds. This is the last logged message.", + self.title, + self.domain, + wait_time, + ) async def setup_again(now: Any) -> None: """Run setup again.""" From da94197d357efb9cb26349ac73cde9e35e5f4968 Mon Sep 17 00:00:00 2001 From: chemelli74 Date: Mon, 1 Mar 2021 11:13:03 +0000 Subject: [PATCH 2/2] Changed logic from "wait_time" to "tries" --- homeassistant/config_entries.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index ae920a6cef8cb..165787a6dbdcc 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -259,16 +259,15 @@ async def async_setup( self.state = ENTRY_STATE_SETUP_RETRY wait_time = 2 ** min(tries, 4) * 5 tries += 1 - if wait_time < 80: + if tries == 1: _LOGGER.warning( - "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds", + "Config entry '%s' for %s integration not ready yet. Retrying in background", self.title, self.domain, - wait_time, ) - elif wait_time == 80: - _LOGGER.warning( - "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds. This is the last logged message.", + else: + _LOGGER.debug( + "Config entry '%s' for %s integration not ready yet. Retrying in %d seconds", self.title, self.domain, wait_time,