Retry transient foreground requests before surfacing errors

This commit is contained in:
Jonathan Sykes
2026-10-09 21:53:03 +08:00
parent 933e920701
commit d02796b0eb
10 changed files with 282 additions and 26 deletions

View File

@@ -82,6 +82,13 @@ test('overlapping layout and completion jobs share a six-download ceiling',async
assert.ok(peak<=6);assert.ok([...calls.values()].every(count=>count===1));
});
test('offline completion keeps its own network concurrency to one',async()=>{
const c=cache(),m=manifest();let active=0,peak=0;
for(let i=0;i<12;i++){const p='/complete'+i+'.js';m.files[p]={h:String(i)};}
const fetchFn=async u=>{active++;peak=Math.max(peak,active);await new Promise(r=>setTimeout(r,2));active--;return response(u.split('=')[1]);};
await core.complete(m,{cache:c,fetchFn});assert.equal(peak,1);
});
test('blocking commit never waits on an optional file readiness probe',{timeout:1000},async()=>{
const c=cache(),m=manifest();m.files['/extra.js']={h:'extra'};m.groups.extra={files:['/extra.js'],background:true,contract:1};
await c.put('/a.js?v=a',response('a'));await c.put('/index.html?v=b',response('b'));