add some logging...
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user