Gate the remote-interval poll on a root ETag check (#189) - #190
Merged
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.
Closes #189.
Problem
The periodic remote-interval poll ran a full
nextcloudcmdreconciliation of every folder every N minutes regardless of whether anything changed, even after #183/#185 (which only apply when the server offersnotify_push). On the large folders this is a full tree re-discovery (tens of thousands of progress events per cycle) - exactly what the user sees as "it keeps syncing even though no files changed". Withremote_interval_minutes=10and no push on the server, Fotos (~65k files), Mi Nube (~16k), Zbox (~11k) re-scan every cycle.Fix (mirrors the official client)
The official client does a cheap ETag poll before deciding to reconcile:
RequestEtagJobis a singlePROPFINDwithDepth: 0asking only for<getetag/>(src/libsync/networkjobs.cpp), andFolder::etagRetrievedcompares it against_lastEtag; the full sync runs only when the root ETag changed (folder.cpp:426).Changes:
NextcloudApi::root_etag: aPROPFIND Depth:0for<getetag/>on the folder root (newPROPFIND_ETAG_BODY), returning the trimmed ETag orNone.EtagProbe/ProductionEtagProbe(mirrors theHealthProbepattern from Mark folder offline after N consecutive failed syncs regardless of error class #179), wired in production viawith_etag_probe.etag_slot(sharedArc<Mutex<Option<String>>>). On a pureRemoteIntervalrun it reads the root ETag and, if unchanged from the last run, reports a cleanSyncOutcome::Successwithout spawningnextcloudcmd. A changed ETag (or first run / unavailable ETag) reconciles as before.etag_gate_appliesonly accepts a soleRemoteInterval.Testing
691 tests (6 new), clippy clean, fmt applied.
New tests:
root_etag_reads_the_etag_with_depth_zero,root_etag_absent_body_yields_none,parse_root_etag_returns_trimmed_text,unchanged_etag_skips_the_interval_run(asserts nextcloudcmd not spawned),changed_etag_reconciles_the_interval_run,manual_run_ignores_the_etag_gate.