From a73bcf870f72de436ef8f15fd7496a66872730d5 Mon Sep 17 00:00:00 2001 From: Cabbagec Date: Fri, 24 Jul 2026 15:26:33 +0000 Subject: [PATCH] config: reduce zero-copy space reserve default --- deploy/production/lithium/client.toml | 2 +- deploy/production/lithium/compose.yaml | 2 +- deploy/production/x1/client.toml | 2 +- deploy/production/x1/compose.yaml | 2 +- deploy/production/x2/client.toml | 2 +- deploy/production/x2/compose.yaml | 2 +- docs/deployment-and-usage.md | 4 ++-- examples/client.toml | 2 +- pyproject.toml | 2 +- src/archive_clients/config.py | 4 ++-- src/archive_clients/jobs.py | 2 +- tests/test_config.py | 1 + tests/test_jobs.py | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/deploy/production/lithium/client.toml b/deploy/production/lithium/client.toml index f01dcab..1b95b24 100644 --- a/deploy/production/lithium/client.toml +++ b/deploy/production/lithium/client.toml @@ -19,7 +19,7 @@ reconnect_jitter = true stall_after = "30m" # Status warning only; it does not fail the job. verification_timeout = "30m" poll_interval = "1s" -free_space_reserve_bytes = 1073741824 # Rechecked immediately before work. +free_space_reserve_bytes = 33554432 # 32 MiB; payload bytes are added for copy paths. [backup] interval = "6h" diff --git a/deploy/production/lithium/compose.yaml b/deploy/production/lithium/compose.yaml index 0b90a04..c6a50f4 100644 --- a/deploy/production/lithium/compose.yaml +++ b/deploy/production/lithium/compose.yaml @@ -2,7 +2,7 @@ name: archive-control-archive services: archive-client: - image: sodium/archive-clients:v0.1.4 + image: sodium/archive-clients:v0.1.5 user: "1000:1000" restart: unless-stopped command: ["--config", "/etc/archive-control/client.toml"] diff --git a/deploy/production/x1/client.toml b/deploy/production/x1/client.toml index 0ffd995..e35a521 100644 --- a/deploy/production/x1/client.toml +++ b/deploy/production/x1/client.toml @@ -19,7 +19,7 @@ reconnect_jitter = true stall_after = "30m" # Status warning only; it does not fail the job. verification_timeout = "30m" poll_interval = "1s" -free_space_reserve_bytes = 1073741824 # Rechecked immediately before work. +free_space_reserve_bytes = 33554432 # 32 MiB; payload bytes are added for copy paths. [backup] interval = "6h" diff --git a/deploy/production/x1/compose.yaml b/deploy/production/x1/compose.yaml index 5eae5aa..fd48d24 100644 --- a/deploy/production/x1/compose.yaml +++ b/deploy/production/x1/compose.yaml @@ -2,7 +2,7 @@ name: archive-control-cache services: archive-client: - image: sodium/archive-clients:v0.1.4 + image: sodium/archive-clients:v0.1.5 user: "1001:1001" restart: unless-stopped network_mode: host diff --git a/deploy/production/x2/client.toml b/deploy/production/x2/client.toml index 9f474e9..0de0369 100644 --- a/deploy/production/x2/client.toml +++ b/deploy/production/x2/client.toml @@ -19,7 +19,7 @@ reconnect_jitter = true stall_after = "30m" # Status warning only; it does not fail the job. verification_timeout = "30m" poll_interval = "1s" -free_space_reserve_bytes = 1073741824 # Rechecked immediately before work. +free_space_reserve_bytes = 33554432 # 32 MiB; payload bytes are added for copy paths. [backup] interval = "6h" diff --git a/deploy/production/x2/compose.yaml b/deploy/production/x2/compose.yaml index 41263c8..e08e881 100644 --- a/deploy/production/x2/compose.yaml +++ b/deploy/production/x2/compose.yaml @@ -2,7 +2,7 @@ name: archive-control-cache services: archive-client: - image: sodium/archive-clients:v0.1.4 + image: sodium/archive-clients:v0.1.5 user: "1001:1001" restart: unless-stopped network_mode: host diff --git a/docs/deployment-and-usage.md b/docs/deployment-and-usage.md index 600e5e4..f4e241c 100644 --- a/docs/deployment-and-usage.md +++ b/docs/deployment-and-usage.md @@ -102,7 +102,7 @@ stall_after = "30m" # Warning only; no automatic job failure. verification_timeout = "30m" # Stopped qB full-recheck deadline. poll_interval = "1s" # Active qB/Syncthing observation interval. # Worst-case copy fallback must leave this many bytes free. -free_space_reserve_bytes = 1073741824 +free_space_reserve_bytes = 33554432 # 32 MiB; payload bytes are added for copy paths. [backup] interval = "6h" @@ -213,7 +213,7 @@ cache/archive routes according to policy. ```yaml services: archive-client: - image: sodium/archive-clients:v0.1.4 + image: sodium/archive-clients:v0.1.5 user: "1001:1001" restart: unless-stopped command: ["archive-client", "--config", "/etc/archive-control/client.toml"] diff --git a/examples/client.toml b/examples/client.toml index 4625b6f..688baf1 100644 --- a/examples/client.toml +++ b/examples/client.toml @@ -21,7 +21,7 @@ verification_timeout = "30m" # Poll qBittorrent and Syncthing at this interval while a step is active. poll_interval = "1s" # Space that must remain free after a worst-case copy fallback. -free_space_reserve_bytes = 1073741824 +free_space_reserve_bytes = 33554432 [backup] interval = "6h" diff --git a/pyproject.toml b/pyproject.toml index c574c23..a911323 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "archive-clients" -version = "0.1.4" +version = "0.1.5" requires-python = ">=3.11" dependencies = ["protobuf==7.35.1", "websockets==16.0"] diff --git a/src/archive_clients/config.py b/src/archive_clients/config.py index af64ea3..dbbbc1f 100644 --- a/src/archive_clients/config.py +++ b/src/archive_clients/config.py @@ -82,7 +82,7 @@ class JobsConfig: stall_after: float = 30 * 60 verification_timeout: float = 30 * 60 poll_interval: float = 1 - free_space_reserve_bytes: int = 1024 * 1024 * 1024 + free_space_reserve_bytes: int = 32 * 1024 * 1024 @dataclass(frozen=True) @@ -239,7 +239,7 @@ def _jobs(value: Any) -> JobsConfig: ), poll_interval=_duration(value.get("poll_interval", "1s")), free_space_reserve_bytes=_positive_int( - value.get("free_space_reserve_bytes", 1024 * 1024 * 1024), + value.get("free_space_reserve_bytes", 32 * 1024 * 1024), "jobs.free_space_reserve_bytes", ), ) diff --git a/src/archive_clients/jobs.py b/src/archive_clients/jobs.py index 1674a0d..e7d0a85 100644 --- a/src/archive_clients/jobs.py +++ b/src/archive_clients/jobs.py @@ -66,7 +66,7 @@ class ClientJobExecutor: sparse_supported: bool, poll_interval: float = 1, verification_timeout: float = 30 * 60, - free_space_reserve_bytes: int = 1024 * 1024 * 1024, + free_space_reserve_bytes: int = 32 * 1024 * 1024, ): self.client_id = client_id self.qbittorrent = qbittorrent diff --git a/tests/test_config.py b/tests/test_config.py index 2dedf72..0bb6562 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -34,6 +34,7 @@ class ConfigTests(unittest.TestCase): root / "qb/a/b", ) self.assertEqual(config.jobs.stall_after, 30 * 60) + self.assertEqual(config.jobs.free_space_reserve_bytes, 32 * 1024 * 1024) self.assertEqual( config.syncthing.advertised_addresses, ("dynamic",) ) diff --git a/tests/test_jobs.py b/tests/test_jobs.py index 34a385b..49af0e4 100644 --- a/tests/test_jobs.py +++ b/tests/test_jobs.py @@ -74,7 +74,7 @@ class ClientJobHappyPathTests(unittest.TestCase): self._run_transfer( Path(directory), job_pb2.JOB_OPERATION_ARCHIVE, - source_stage_free_bytes=1024 * 1024 * 1024 + 1024, + source_stage_free_bytes=32 * 1024 * 1024 + 1024, content=b"x" * 4096, )