Skip to content

Mark the account offline when its server is unreachable (#179) - #187

Merged
gnacho merged 1 commit into
mainfrom
fix/179-server-unreachable
Aug 26, 2026
Merged

gnacho merged 1 commit into
mainfrom
fix/179-server-unreachable

Conversation

@gnacho

@gnacho gnacho commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Implements #179: when a folder fails and a health probe against the server fails, the account goes offline instead of showing "Connected" and retrying on every trigger.

Changes:

  • HealthProbe + ProductionHealthProbe in the sync engine (sync_engine.rs), using NextcloudApi::server_status (GET to the server root; <500 = alive, 5xx/transport = dead).
  • Engine thread: an ensurer Http{5xx} runs the probe and short-circuits to NetworkError without spawning nextcloudcmd when the server is dead; a Failed run with a dead probe becomes NetworkError.
  • Scheduler: server_unreachable gate + schedule_server_probe() every 30s (SERVER_PROBE_INTERVAL_MS) that re-checks and recovers; non-manual triggers only queue while unreachable, freeing the global sync permit for healthy folders.
  • Folder row message: "Synchronization blocked: the server is unreachable" (msgid already translated).
  • 6 new tests (red-green verified), 676 passed, clippy/fmt clean.

Context: the 26-Aug incident where hub.cloudless.club returned 502 all day (CT 222 lost its DHCP IP) and the account kept showing "Connected" while every sync failed.

A Failed outcome alone cannot tell a broken folder from an unreachable
account (a reverse proxy answering 502, a dead backend). Two halves:

- Engine: a 5xx from the remote ensurer, or a run ending Failed, now
  triggers a short server health probe. A dead probe upgrades the
  outcome to NetworkError without spawning nextcloudcmd; a live probe
  keeps the folder-level Failed.
- Scheduler: a NetworkError outcome arms a server-unreachable gate.
  Automatic triggers only queue (the folder stops occupying the global
  permit, so a healthy account keeps syncing) and a 30s probe re-checks
  the server until the first success clears the gate. The folder row
  reads 'Synchronization blocked: the server is unreachable' instead of
  the generic network message.
@gnacho
gnacho merged commit 3ef1252 into main Aug 26, 2026
2 checks passed
@gnacho
gnacho deleted the fix/179-server-unreachable branch August 26, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant