feat: 历史归档按名称默认只保留最近7天
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user