Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recorder stop on SQLite vacuuming error #10405

Merged
merged 2 commits into from Nov 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/recorder/purge.py
Expand Up @@ -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)