Official-client parity: file-id routing, failure backoff, push-aware intervals, heartbeat (#183 #184 #185 #186) - #188
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmarked against the official Nextcloud desktop client (nextcloud/desktop) and ported four robustness/performance improvements. Closes #183, #184, #185, #186.
#183 — Resolve
notify_file_idand sync only the affected folderThe push client treated every
notify_file_id <id>as a generic change and fanned outRemotePushto every folder of the account. The official client resolves the id against its folder journal (SyncJournalDb::hasFileIds) and schedules only the folder that owns the file.push.rs: opt in tolisten n_idafterauthenticated; parsenotify_file_id <json-array>into file ids (FileNotification(Vec<i64>)); a legacynotify_filekeeps an empty list.core/files_journal.rs: read-only lookup of the external engine's.sync_*.dbjournal (the same journal nextcloudcmd keeps), answering whether a folder knows any notified id (metadata.fileidcompared viaCAST(... AS INTEGER)).Scheduler::has_file_ids+apply_remote_push: route the hint to only the folders that contain the file; empty ids (legacy) still fan out.#184 — Per-folder consecutive-failure backoff (10/30/60s)
The official client delays the next run by 10s/30s/60s depending on
consecutiveFailingSyncs. Ours re-ran on every trigger.consecutive_failing_syncscounter on the scheduler (reset on success/conflict, incremented on failure).failure_backoff_seconds()(10/30/60) +schedule_after():cooldown_finishedbacks off instead of re-running immediately once 3+ consecutive failures accrue.#185 — Skip remote-interval polling while push is active
slotEtagPollTimerTimeoutin the official client only polls accounts whose push is not ready. Ours armedRemoteIntervalregardless.remote_push_readyflag on the scheduler (set_remote_push_ready), wired fromstore_push_state: when the account's push isConnected, aRemoteIntervaltrigger is dropped.#186 — WebSocket heartbeat + capped auth retries
The official client sends a 30s ping, detects a missing pong within its timeout, and caps auth attempts at 3.
push.rs: tracklast_activityin the worker loop; a connection with no inbound text/ping/pong forPUSH_HEARTBEAT_TIMEOUT_MS(75s) is torn down and reconnects (no silent zombie).MAX_PUSH_AUTH_ATTEMPTS(3); once exhausted the channel parks inAuthRequiredinstead of reconnecting in a loop. The streak resets onAuthenticatedand on coming back online.Testing
685 tests (added 8), clippy clean, fmt applied.
New tests cover notify_file_id parsing, journal file-id membership, the failure-backoff table, and dropping RemoteInterval while push is ready.