Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67 +/- ##
==========================================
+ Coverage 97.57% 98.13% +0.56%
==========================================
Files 9 9
Lines 3707 5371 +1664
==========================================
+ Hits 3617 5271 +1654
- Misses 90 100 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2e43b6a to
bb2079b
Compare
efd444e to
17c8719
Compare
Keep rolandjitsu#72, rolandjitsu#76 and rolandjitsu#77 with internal maintenance while deferring rolandjitsu#67. Preserve the previous tree on its archive branch and in normal history. Assisted-by: OpenAI:Codex
b689415 to
3ba149d
Compare
Opt in with --max-stale-seconds: serve cached refs within the age bound and refresh in the background, so clients do not wait on a TTL-expired upstream fetch. Age is persisted in proxy-refresh.json so a restart does not reset it. Refs: rolandjitsu#66 Assisted-by: Codex:gpt-6.1-terra Assisted-by: Claude:claude-opus-4-8
|
Thanks for the careful review, it improved the patch. Pushed Summary of what changed since your review:
Separately, a few older tests on |
|
@rolandjitsu thanks again for the thorough review. I have addressed all the comments ( Before you spend more time on this, I would like to ask whether it is still worth carrying. I have started to doubt the cost/benefit:
If you think the feature is still wanted, I will keep going. If not, I am happy to close this PR. #66 can stay open for a smaller design, for example scheduled refresh on its own. |
I think #79 is more aligned with what was also on the roadmap and has fewer risks and reduced complexity. Let's close this one and focus on #79. I appreciate the contributions so far. I hope this won't demotivate you. |
What kind of change does this PR introduce?
Summary
When the fetch TTL expires, clients currently wait for an upstream fetch even if the mirror already contains their objects. This adds opt-in stale-while-revalidate: serve cached refs within a configured maximum age and refresh in the background. Closes #66.
Refreshes are coalesced per repository and bounded across repositories. Successful full-ref refreshes persist their observation start time in
proxy-refresh.json. Restart restores age only when the record matches the repository, configured upstream and mirror directory identity. Missing, corrupt, oversized, future-dated or replaced records require a full refresh. Failed refreshes and SHA-only backfills do not renew full-ref age.Stale mode separates body decoding, freshness inspection, mandatory upstream work and local delivery admission. Slow or cancelled upstream requests retain bounded owners without consuming every local-service slot. Overload returns 503 rather than queueing another expensive owner. Cached GET advertisements remain available when request-body admission is full. Strict mode retains its existing queueing behavior.
Cold clones must satisfy the age bound when they finish. Uploads recheck age and identity after waiting for an upload slot, immediately before Git starts; already started streams can complete after the refs expire. Mirror guards and stale-serving leases remain held until their Git child is reaped.
This is request-triggered refresh, not scheduled polling. The default remains unchanged. This PR does not include #72's concurrent upload-pack negotiation or introduce a general upstream timeout or shutdown-cancellation setting.
Tests
Checklist
Breaking change?
No behavior change with the default settings. With stale serving enabled, clients may read older objects already present in the same mirror, and overloaded admission lanes now return 503. Persistent age recovery assumes a correct wall clock across downtime and a single proxy process owning the cache root. Cold mirrors still require a complete upstream mirror clone.