Do not trust empty backups when sources are configured

Restoring a backup with no data while sources are configured now sets the
db_recreated.json marker (503 until data is collected), and the backup job
skips copying an empty database in that state. Adds finding 11 to the review.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ayurishchevandClaude Sonnet 5 committed 2026-09-21 10:30:03 +03:00
1 parent aaf41adc79
commit ab89c87321
7 files changed
+134 -7

No files matched your search

+3
View File
@@ -28,6 +28,9 @@ def run_backup():
keep = max(1, int(load_full_config().get("backup_keep", cc.DEFAULT_BACKUP_KEEP)))
with db.session() as conn:
path = db.backup_database(conn, datetime.datetime.now(), keep)
if path is None:
logger.warning("Database backup skipped: no data yet although sources are configured")
return
logger.info("Database backup written to %s (keeping the last %d)", path, keep)