(bugfix) Reconcile failed dry-runs from rsync terminal logs

Classify rsync failures in run results so transport issues such as exit
255 and broken pipes show clearer diagnostic hints.

Teach the worker to reconcile running dry-runs when their log already
contains a terminal rsync error, and to fail stale dry-runs after their
timeout window. This prevents failed rsync processes from leaving runs
stuck in the running state indefinitely.
This commit is contained in:
2026-05-19 21:10:08 +02:00
parent d67ba9cada
commit d52a9167d1
5 changed files with 201 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ from django.conf import settings
from django.core.management.base import BaseCommand
from pobsync.paths import PobsyncPaths
from pobsync_backend.backup_runner import claim_next_queued_run, execute_backup_run, requested_options
from pobsync_backend.backup_runner import claim_next_queued_run, execute_backup_run, reconcile_running_runs, requested_options
class Command(BaseCommand):
@@ -33,9 +33,10 @@ class Command(BaseCommand):
time.sleep(max(1, int(options["interval"])))
def _run_once(self, *, prefix: Path) -> int:
reconciled = reconcile_running_runs()
run = claim_next_queued_run()
if run is None:
return 0
return reconciled
options = requested_options(run)
try:
@@ -49,4 +50,4 @@ class Command(BaseCommand):
)
except Exception as exc:
self.stderr.write(f"{run.host.host}: {type(exc).__name__}: {exc}")
return 1
return reconciled + 1