mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Fix recorder stop on SQLite vacuuming error (#10405)
* Fix recorder stop on SQLite vacuuming error * Move import to function
This commit is contained in:
parent
2e5b1e76ef
commit
2f0920e4fb
@ -28,5 +28,10 @@ def purge_old_data(instance, purge_days):
|
||||
# Execute sqlite vacuum command to free up space on disk
|
||||
_LOGGER.debug("DB engine driver: %s", instance.engine.driver)
|
||||
if instance.engine.driver == 'pysqlite':
|
||||
from sqlalchemy import exc
|
||||
|
||||
_LOGGER.info("Vacuuming SQLite to free space")
|
||||
instance.engine.execute("VACUUM")
|
||||
try:
|
||||
instance.engine.execute("VACUUM")
|
||||
except exc.OperationalError as err:
|
||||
_LOGGER.error("Error vacuuming SQLite: %s.", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user