add some logging...

This commit is contained in:
2026-09-02 20:43:40 +02:00
parent 771e81f50b
commit 828c0a1d7b
+4 -1
View File
@@ -51,7 +51,8 @@ export async function download(stream: StreamSummary) {
partials.delete(stream.id);
cached.add(stream.id);
return;
} catch {
} catch (err) {
console.error(`[streamCache] ${stream.id} attempt failed`, err);
// reset attempts if download of at least one chunk successful
attempt = (partials.get(stream.id)?.received ?? 0) > before ? 0 : attempt + 1;
if (attempt === MAX_ATTEMPTS) return;
@@ -90,7 +91,9 @@ async function attemptDownload(stream: StreamSummary) {
partials.set(stream.id, state);
downloading.set(stream.id, percent(state.received, state.total));
}
console.log(`[streamCache] ${stream.id} assembling ${state.total} bytes`);
await assemble(stream.id, state.total);
console.log(`[streamCache] ${stream.id} assembled`);
}
/** fetch chunk starting from the last valid one, store in OPFS, and return updated state */