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.
This commit is contained in:
J. Nick Koston 2020-08-17 02:47:50 -05:00 committed by Paulus Schoutsen
parent 7fb879f191
commit 68c83ea629

View File

@ -534,6 +534,14 @@ class Recorder(threading.Thread):
if self.db_url != SQLITE_URL_PREFIX and self.db_url.startswith(
SQLITE_URL_PREFIX
):
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: