Skip to content

feat(git): serve cached refs during background refresh - #67

Open
profiling wants to merge 1 commit into
rolandjitsu:mainfrom
profiling:feat/background-refresh
Open

profiling wants to merge 1 commit into
rolandjitsu:mainfrom
profiling:feat/background-refresh

Conversation

@profiling

Copy link
Copy Markdown

What kind of change does this PR introduce?

  • feat

Summary
Clients currently wait for an upstream fetch when the fetch TTL expires, even if the mirror can already serve their request. This adds opt-in stale-while-revalidate behavior: serve cached refs within a configured maximum age and refresh the mirror in the background.

Background fetches are coalesced per repository and bounded across repositories. Cold mirrors and mirrors with unknown freshness keep the synchronous path. The default remains unchanged. This is request-triggered refresh, not a scheduled polling loop.

Closes #66.

Tests

  • Added unit and HTTP tests for freshness boundaries, coalescing, concurrency limits, failure cooldown, cancellation, eviction and serving during a blocked fetch.
  • 101 tests pass; coverage is 97.67%.

Checklist

  • Local formatting, clippy and all-feature tests passed.
  • Conventional Commit with an Assisted-by trailer.
  • Preserves read-only, pull-only behavior.
  • README and Helm settings updated.

Breaking change?
No change with the default settings. With stale serving enabled, clients may read older objects already present in the repository mirror. Objects are never searched in other mirrors.

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.90909% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.70%. Comparing base (623148c) to head (bb2079b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/server.rs 73.68% 5 Missing ⚠️
src/git.rs 99.49% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #67      +/-   ##
==========================================
+ Coverage   97.12%   97.70%   +0.57%     
==========================================
  Files           6        7       +1     
  Lines        2333     3138     +805     
==========================================
+ Hits         2266     3066     +800     
- Misses         67       72       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@profiling
profiling force-pushed the feat/background-refresh branch from 2e43b6a to bb2079b Compare November 3, 2026 11:39
Keep refresh work bounded and preserve active Git requests during
cancellation and eviction.

Refs: rolandjitsu#66

Assisted-by: Codex:gpt-6.1-terra
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.

[FEATURE] Serve cached refs while refreshing in the background

1 participant