瀏覽代碼

Add "compact_threshold" option, overridden by "compact --threshold" flag (#303).

Dan Helfman 3 月之前
父節點
當前提交
976fb8f343
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 1 1
      borgmatic/actions/compact.py
  2. 6 0
      borgmatic/config/schema.yaml

+ 1 - 1
borgmatic/actions/compact.py

@@ -39,7 +39,7 @@ def run_compact(
             remote_path=remote_path,
             remote_path=remote_path,
             progress=compact_arguments.progress or config.get('progress'),
             progress=compact_arguments.progress or config.get('progress'),
             cleanup_commits=compact_arguments.cleanup_commits,
             cleanup_commits=compact_arguments.cleanup_commits,
-            threshold=compact_arguments.threshold,
+            threshold=compact_arguments.threshold or config.get('compact_threshold'),
         )
         )
     else:  # pragma: nocover
     else:  # pragma: nocover
         logger.info('Skipping compact (only available/needed in Borg 1.2+)')
         logger.info('Skipping compact (only available/needed in Borg 1.2+)')

+ 6 - 0
borgmatic/config/schema.yaml

@@ -565,6 +565,12 @@ properties:
             not specified, borgmatic defaults to matching archives based on the
             not specified, borgmatic defaults to matching archives based on the
             archive_name_format (see above).
             archive_name_format (see above).
         example: sourcehostname
         example: sourcehostname
+    compact_threshold:
+        type: integer
+        description: |
+            Minimum saved space percentage threshold for compacting a segment,
+            defaults to 10.
+        example: 20
     checks:
     checks:
         type: array
         type: array
         items:
         items: