From ab2b2f6dd5e97abb0e92abd6feff8e15895674db Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" <nick@koston.org> Date: Mon, 17 Aug 2020 02:47:50 -0500 Subject: [PATCH] Accommodate systems with very large databases and slow disk/cpu (#38947) On startup we run an sqlite3 quick_check to verify the database integrity. In the majority of cases, the quick_check takes under 10 seconds. On systems with very large databases and very slow disk/cpu, this can take much longer so we freeze the timeout. --- homeassistant/components/recorder/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index d0c18256377..8798b213ec9 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -534,7 +534,15 @@ class Recorder(threading.Thread): if self.db_url != SQLITE_URL_PREFIX and self.db_url.startswith( SQLITE_URL_PREFIX ): - validate_or_move_away_sqlite_database(self.db_url) + with self.hass.timeout.freeze(DOMAIN): + # + # Here we run an sqlite3 quick_check. In the majority + # of cases, the quick_check takes under 10 seconds. + # + # On systems with very large databases and + # very slow disk or cpus, this can take a while. + # + validate_or_move_away_sqlite_database(self.db_url) if self.engine is not None: self.engine.dispose()