Repository navigation
✨ Serve expired WebDAV listings while they are refreshed - #69
Merged
Merged
Conversation
A client walking a tree after a pause (PrivateBin's purge lists every folder of its store, one after the other) paid one API round trip per folder once the 30 s listing cache had expired: ~4 s for 60 folders. Folder listings and the dataroom list are now served fresh under webdav.cache.ttl (default 1m), then served expired for webdav.cache.max_stale more (default 5m, 0 disables) while one background refresh replaces them. Background refreshes run at most api.concurrency.list at a time; a request needing a queued one starts it at once. A name missing from an expired listing waits for the refresh instead of answering 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is consistent, documented, and thoroughly covers expiry, concurrency, failure, and mutation scenarios.
Review effort: Balanced
Findings: None
What changed in this PR
Adds stale-while-revalidate caching to improve WebDAV tree traversal performance.
Changes:
- Adds configurable cache TTL and maximum stale duration.
- Bounds and promotes asynchronous listing refreshes.
- Adds cache telemetry, documentation, and comprehensive tests.
| File | Description |
|---|---|
cmd/webdav.go |
Implements stale cache serving and background refreshes. |
cmd/webdav_test.go |
Tests cache expiry, refresh, concurrency, and mutation races. |
internal/config/config.go |
Adds validated WebDAV cache settings. |
internal/config/config_test.go |
Tests cache configuration and validation. |
internal/metrics/metrics.go |
Adds the stale cache lookup result. |
internal/telemetry/attrs.go |
Adds stale-cache trace attribution. |
doc/webdav.md |
Documents caching behavior and observability. |
doc/configuration.md |
Documents new configuration keys. |
CLAUDE.md |
Records the cache architecture and invariants. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
A client walking a tree after a pause (PrivateBin's purge lists every folder of its store, one after the other) paid one API round trip per folder once the 30 s listing cache had expired: ~4 s for 60 folders.
Folder listings and the dataroom list are now served fresh under webdav.cache.ttl (default 1m), then served expired for webdav.cache.max_stale more (default 5m, 0 disables) while one background refresh replaces them. Background refreshes run at most api.concurrency.list at a time; a request needing a queued one starts it at once. A name missing from an expired listing waits for the refresh instead of answering 404.