feat: 历史归档按名称默认只保留最近7天

This commit is contained in:
2026-11-09 15:03:28 +08:00
parent f849950c5a
commit 3cd1196010
9 changed files with 219 additions and 1 deletions
+8
View File
@@ -23,6 +23,14 @@ def run(settings_path: Path, output_dir: Path, dry_run: bool) -> int:
history = None
if store is not None and settings.history_enabled:
history = main.StorageHistoryStore(storage, settings.history_root)
if not dry_run and settings.history_keep_days > 0:
try:
removed = main.StorageHistoryStore(storage, settings.history_root).prune(settings.history_keep_days)
except main.ProcessingError as exc:
print(f"history_prune_error={exc}")
else:
for path in removed:
print(f"history_removed={path}")
main.process(source, output_dir, settings.lookback_days, store=store, history=history)
finally:
close_quietly(storage)