Skip to content

✨ Serve expired WebDAV listings while they are refreshed - #69

Merged
HanXHX merged 1 commit into
masterfrom
feat/webdav_stale_cache
Oct 5, 2026
Merged

HanXHX merged 1 commit into
masterfrom
feat/webdav_stale_cache

Conversation

@HanXHX

@HanXHX HanXHX commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

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.

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>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@HanXHX
HanXHX merged commit a983bb8 into master Oct 5, 2026
4 checks passed
@HanXHX
HanXHX deleted the feat/webdav_stale_cache branch October 5, 2026 15:12
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.

2 participants