Skip to content

List a folder that does not change less and less often - #15

Open
dkgs2000 wants to merge 2 commits into
mainfrom
claude/folder-poll-backoff
Open

dkgs2000 wants to merge 2 commits into
mainfrom
claude/folder-poll-backoff

Conversation

@dkgs2000

Copy link
Copy Markdown
Owner

Why

The background sync listed every folder holding something local, and every folder above it, at every run: one request per folder every 30 s, for good. After a large upload that is hundreds of folders, and the server gets a constant stream of requests.

Nextcloud avoids this with one ETag request for the top folder. A plain WebDAV server has no folder ETags, and no folder time that changes with what is below it, so only listing a folder says whether it changed.

What changes

  • Each folder has its own wait (FolderPollSchedule). A listing that comes back the same doubles the wait, from 30 s up to 30 min (OPENCFDRIVE_REMOTE_POLL_MAX_SECONDS), spread by a tenth either way.
  • Back to 30 s when the listing changed, while something is still to be applied (a file open in a program, the client's own change on its way), and when the folder is used here (a local change sent, a download).
  • Always listed: the top folder. Everything listed: on the sync request, on coming back online, and after a restart.
  • A folder's own time is not part of "the same". rclone reports the time of the listing for folders on remotes that keep none (S3), which would make every listing look new.
  • "Not found" lists the folders above at once, nearest first, until one is found. They used to be listed first in the same run; now they may not be due for a while.
  • Status page: "1,240 folders kept current; 37 to check in the next minute".
  • sync-scheduled control request: a run as the timer starts one, so the end-to-end suite can show that such a run leaves an unchanged folder alone (S36). sync still lists everything, which the other scenarios rely on.

The price

A change someone else makes in a folder that has been quiet here can take up to 30 min to show, where it took 30 s. The app has no "Sync now" action yet; that is a separate change.

Depends on #14

This branch is cut from #14 (the Status page's Items row, which the new row sits under, comes from there), so its first commit is #14's. Merge #14 first; the last commit is this change.

Tests

Run locally on this branch, before main's two newer commits (#13, #10) were merged in; the branch merges with main without conflicts.

Suite Result
Unit and contract tests 333 passed
End-to-end, cloud, WebDAV 69 of 69
End-to-end, cloud, S3 69 of 69
End-to-end, mock, WebDAV 27 passed, 42 cloud-only skipped

New: FolderPollScheduleTests (the waits, what brings a folder back, and a run against a server that counts what it is asked: in an hour of 30 s runs a quiet folder is listed 7 times, not 120), scenario S36, and tests for the two sync requests and the status text.

Not covered end to end: the listing of the folders above after "not found" (unit-tested; the 404 was checked against rclone 1.75.2). Not tried against a real server.

🤖 Generated with Claude Code

dkgs2000 and others added 2 commits November 28, 2026 00:49
…ing page

About held the version and its updates, but also what the sync service
and rclone report and where the logs are. Those now have their own page,
Troubleshooting, between Settings and About, with a Report a problem
button that opens a new GitHub issue, as the user guide asks people to.

About is now what an app's About page has: the version and the tagline,
links to the project on GitHub, its release notes and the user guide,
the update check, the credits (rclone, with the version this PC runs,
.NET, SQLite, C#/WinRT) with the third-party notices, and the MIT
License. The notices and the license open the copies the installer puts
beside the app, or the project's own on GitHub in a build that isn't
installed. The GitHub links point to the repository the build updates
from, else dkgs2000/OpenCfDrive. An update's link says "What's new in
1.4.0" instead of "Release page".

On Settings, General (start at sign-in, updates) now comes before rclone:
it was below the fold at the size the window opens. On Status, the Drive
card gains the items tracked and downloaded (from About), and the state
card offers Troubleshoot when something is wrong.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The background sync listed every folder holding something local, and
every folder above it, at every run: one request per folder every 30 s
for good. After a large upload that is hundreds of folders, and the
server gets a constant stream of requests. Nextcloud avoids this with
one ETag request for the top folder; a plain WebDAV server has no folder
ETags, and no folder time that changes with what is below it, so only
listing a folder says whether it changed.

Each folder now has its own wait (FolderPollSchedule). One whose listing
comes back the same waits twice as long as before, from the poll
interval up to 30 min (OPENCFDRIVE_REMOTE_POLL_MAX_SECONDS), each wait
spread by a tenth either way so folders do not fall due together. It
waits one interval again when its listing changed, while something is
still to be applied (a file open in a program, the client's own change
on its way), and when it is used here: a local change sent, a download.
The top folder is listed at every run. The service's "sync" request and
coming back online list every folder, and so does a restart (the waits
are kept in memory).

"The same" is a fingerprint of the listing: each item's name, kind,
size, time and hash. A folder's own time is left out: rclone reports the
time of the listing for folders on remotes that keep none (S3), which
would make every listing look new.

A folder the server answers "not found" for was deleted or renamed
there, or a folder above it was. The folders above used to be listed
first in the same run, which removed it; now they may not be due for a
while. So they are listed at once, nearest first, until one is found.
The first "not found" is logged; a second in a row, when the folder
above still lists it, is reported as a problem as before.

The Status page says how many folders are kept current and how many are
due in the next minute. A "sync-scheduled" control request starts a run
as the timer does, so the end-to-end suite can show that such a run
leaves an unchanged folder alone (S36); "sync" still lists them all,
which the other scenarios rely on.

The price: a change someone else makes in a folder that has been quiet
here can take up to 30 min to show, where it took 30 s.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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