Skip to content

Commit 990cadb

Browse files
committed
more logs
1 parent f0f88f4 commit 990cadb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/hub/src/utils/XetBlob.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,15 @@ export class XetBlob extends Blob {
217217
const termRanges = rangeList.getRanges(term.range.start, term.range.end);
218218

219219
if (termRanges.every((range) => range.data)) {
220+
console.log("all data available for term", term.hash, readBytesToSkip);
220221
rangeLoop: for (const range of termRanges) {
221222
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
222223
for (let chunk of range.data!) {
223224
if (chunk.length > maxBytes - totalBytesRead) {
224225
chunk = chunk.slice(0, maxBytes - totalBytesRead);
225226
}
226227
totalBytesRead += chunk.length;
228+
console.log("yield", chunk.length, "bytes", "total read", totalBytesRead);
227229
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
228230
// if there's more than one range for the same term
229231
yield range.refCount > 1 ? chunk.slice() : chunk;
@@ -250,6 +252,7 @@ export class XetBlob extends Blob {
250252

251253
console.log("term", term);
252254
console.log("fetchinfo", fetchInfo);
255+
console.log("readBytesToSkip", readBytesToSkip);
253256

254257
let resp = await customFetch(fetchInfo.url, {
255258
headers: {
@@ -286,7 +289,7 @@ export class XetBlob extends Blob {
286289
const result = await reader.read();
287290
done = result.done;
288291

289-
console.log("read", result.value?.length, "bytes", "total read", totalBytesRead);
292+
console.log("read", result.value?.length, "bytes", "total read", totalBytesRead, "toSkip", readBytesToSkip);
290293

291294
if (!result.value) {
292295
continue;
@@ -312,7 +315,7 @@ export class XetBlob extends Blob {
312315
uncompressed_length: header.getUint8(5) | (header.getUint8(6) << 8) | (header.getUint8(7) << 16),
313316
};
314317

315-
console.log("chunk header", chunkHeader);
318+
console.log("chunk header", chunkHeader, "to skip", readBytesToSkip);
316319

317320
if (chunkHeader.version !== 0) {
318321
throw new Error(`Unsupported chunk version ${chunkHeader.version}`);

0 commit comments

Comments
 (0)