onedrive: keep the delta token when a ChangeNotify poll fails - fixes #10009 - #10017
Open
xiaozou-wine wants to merge 1 commit into
Open
xiaozou-wine wants to merge 1 commit into
xiaozou-wine wants to merge 1 commit into
Conversation
…clone#10009 A failed delta poll used to wipe the stored resume token: changeNotifyRunner returned a named nextDeltaToken which stayed empty on error, and the caller stored it unconditionally. Later polls then asked for /root/delta?token= instead of resuming, so notifications stopped until the mount was restarted. changeNotifyNextChange also called the API without the pacer, so a single transient 503 was enough to trigger this. While fixing that, walk @odata.nextLink as well. A change set spanning more than one page returns nextLink without a deltaLink, and the token parsed from the missing deltaLink was empty - changes were dropped even when no error occurred. Fixes rclone#10009
xiaozou-wine
force-pushed
the
onedrive-changenotify-delta-token
branch
from
October 2, 2026 05:01
8183c55 to
67e03df
Compare
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.
What does this change do?
Fixes three defects in the OneDrive
ChangeNotifydelta polling path, all inbackend/onedrive/onedrive.go:A failed poll wiped the stored resume token.
changeNotifyRunnerreturned a namednextDeltaTokenwhich stayed""on error, and the caller stored it unconditionally, so later polls asked for/root/delta?token=instead of resuming from the lastdeltaLink. Notifications then stopped until the mount was restarted. The runner now returns an explicit(string, error)and the caller only advances the stored token whenerr == nil.changeNotifyNextChangebypassed the pacer. It calledf.srv.CallJSONdirectly, the only API call in the file that doesn't go throughf.pacer.Call/shouldRetry, so a single transient 503 was enough to trip defect 1. It is now wrapped, so a 503 is retried honouringRetry-After.@odata.nextLinkwas ignored. When a change set spans more than one page Graph returns@odata.nextLinkand no@odata.deltaLink, so the token parsed from the missingdeltaLinkcame back empty and that poll's changes were dropped — with no error involved at all. The runner now walks the pages the same way_listAllalready does atonedrive.go:1344.Two
httptest-based unit tests were added toonedrive_internal_test.go: one asserting that a failing poll is retried by the pacer and returns no token (so the caller retains the previous one), one asserting that every page of a multi-page change set is notified and the resume token comes from the last page. Both fail against current master.Linked issue
Fixes #10009
For new or changed backends
This is a bug fix to an existing backend, not a new backend. I do not have a SharePoint or OneDrive account to run the integration tests against, so no
test_allrun is included — the verification below is unit tests only.Verification run locally:
make quicktestpasses for every package exceptcmd/nfsmount, which fails on this machine because it cannot mount FUSE (fsconfig() failed: NFS: mount program didn't pass remote address). That failure is present on unmodifiedmastertoo, and is a local environment limitation rather than anything to do with this change.cmd/gitannex, which also fails if therclonebinary isn't in$PATH, passes aftermake.Checklist
test_allpasses for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.No documentation change: this fixes behaviour that already contradicted what the docs and the
ChangeNotifierinterface describe, without changing any flag or option. Thetest_allbox is left unticked deliberately, as noted above — I'd be glad to run it if someone can point me at a test account.