fix: use job-specific sparse transfer progress

This commit is contained in:
2026-07-25 03:01:34 +00:00
parent 9df2e6991e
commit 90925fd321
6 changed files with 18 additions and 10 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ name: archive-control-archive
services: services:
archive-client: archive-client:
image: sodium/archive-clients:v0.1.11 image: sodium/archive-clients:v0.1.12
user: "1000:1000" user: "1000:1000"
restart: unless-stopped restart: unless-stopped
command: ["--config", "/etc/archive-control/client.toml"] command: ["--config", "/etc/archive-control/client.toml"]
+1 -1
View File
@@ -2,7 +2,7 @@ name: archive-control-cache
services: services:
archive-client: archive-client:
image: sodium/archive-clients:v0.1.11 image: sodium/archive-clients:v0.1.12
user: "1001:1001" user: "1001:1001"
restart: unless-stopped restart: unless-stopped
network_mode: host network_mode: host
+1 -1
View File
@@ -2,7 +2,7 @@ name: archive-control-cache
services: services:
archive-client: archive-client:
image: sodium/archive-clients:v0.1.11 image: sodium/archive-clients:v0.1.12
user: "1001:1001" user: "1001:1001"
restart: unless-stopped restart: unless-stopped
network_mode: host network_mode: host
+1 -1
View File
@@ -218,7 +218,7 @@ cache/archive routes according to policy.
```yaml ```yaml
services: services:
archive-client: archive-client:
image: sodium/archive-clients:v0.1.11 image: sodium/archive-clients:v0.1.12
user: "1001:1001" user: "1001:1001"
restart: unless-stopped restart: unless-stopped
command: ["archive-client", "--config", "/etc/archive-control/client.toml"] command: ["archive-client", "--config", "/etc/archive-control/client.toml"]
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "archive-clients" name = "archive-clients"
version = "0.1.11" version = "0.1.12"
requires-python = ">=3.11" requires-python = ">=3.11"
dependencies = ["protobuf==7.35.1", "websockets==16.0"] dependencies = ["protobuf==7.35.1", "websockets==16.0"]
+13 -5
View File
@@ -192,11 +192,19 @@ class SyncthingTransferObserver:
for relative_path, expected_bytes in declared_files for relative_path, expected_bytes in declared_files
) )
observed_fraction = observed_bytes / total if total else 1.0 observed_fraction = observed_bytes / total if total else 1.0
# Folder completion remains useful when Syncthing has already # ``/db/completion`` is folder-wide. It can be near zero when a
# atomically published a file but still reports it in its need # route contains a freshly-created item even though the tracked
# queue; the allocated-byte estimate is needed for sparse temp # job's temporary payload has already received many blocks. For
# files that are pre-sized before their blocks arrive. # an incomplete temporary file, its allocated blocks are the only
fraction = min(observed_fraction, float(raw_fraction) / 100) # job-specific signal, so do not cap them with that unrelated
# folder aggregate. Once every declared file is atomically
# present, retain the completion value as a conservative guard
# until the need queue has caught up.
fraction = (
observed_fraction
if observed_fraction < 1.0
else min(1.0, float(raw_fraction) / 100)
)
completed_bytes = int(total * fraction) completed_bytes = int(total * fraction)
if complete: if complete:
fraction = 1.0 fraction = 1.0