Skip to content

Commit 73490f8

Browse files
committed
add back logging to check why browser test fails
1 parent c2cc1d8 commit 73490f8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/hub/src/utils/XetBlob.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ interface ChunkHeader {
8282
const CHUNK_HEADER_BYTES = 8;
8383

8484
// eslint-disable-next-line @typescript-eslint/no-unused-vars
85-
const debug = (...args: unknown[]) => {};
85+
const log = (...args: unknown[]) => {};
8686

8787
/**
8888
* XetBlob is a blob implementation that fetches data directly from the Xet storage
@@ -228,7 +228,7 @@ export class XetBlob extends Blob {
228228
const termRanges = rangeList.getRanges(term.range.start, term.range.end);
229229

230230
if (termRanges.every((range) => range.data)) {
231-
debug("all data available for term", term.hash, readBytesToSkip);
231+
log("all data available for term", term.hash, readBytesToSkip);
232232
rangeLoop: for (const range of termRanges) {
233233
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
234234
for (let chunk of range.data!) {
@@ -244,7 +244,7 @@ export class XetBlob extends Blob {
244244
chunk = chunk.slice(0, maxBytes - totalBytesRead);
245245
}
246246
totalBytesRead += chunk.length;
247-
debug("yield", chunk.length, "bytes", "total read", totalBytesRead);
247+
log("yield", chunk.length, "bytes", "total read", totalBytesRead);
248248
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
249249
// if there's more than one range for the same term
250250
yield range.refCount > 1 ? chunk.slice() : chunk;
@@ -269,9 +269,9 @@ export class XetBlob extends Blob {
269269
);
270270
}
271271

272-
debug("term", term);
273-
debug("fetchinfo", fetchInfo);
274-
debug("readBytesToSkip", readBytesToSkip);
272+
log("term", term);
273+
log("fetchinfo", fetchInfo);
274+
log("readBytesToSkip", readBytesToSkip);
275275

276276
let resp = await customFetch(fetchInfo.url, {
277277
headers: {
@@ -310,7 +310,7 @@ export class XetBlob extends Blob {
310310

311311
done = result.done;
312312

313-
debug("read", result.value?.length, "bytes", "total read", totalBytesRead, "toSkip", readBytesToSkip);
313+
log("read", result.value?.length, "bytes", "total read", totalBytesRead, "toSkip", readBytesToSkip);
314314

315315
if (!result.value) {
316316
continue;
@@ -336,7 +336,7 @@ export class XetBlob extends Blob {
336336
uncompressed_length: header.getUint8(5) | (header.getUint8(6) << 8) | (header.getUint8(7) << 16),
337337
};
338338

339-
debug("chunk header", chunkHeader, "to skip", readBytesToSkip);
339+
log("chunk header", chunkHeader, "to skip", readBytesToSkip);
340340

341341
if (chunkHeader.version !== 0) {
342342
throw new Error(`Unsupported chunk version ${chunkHeader.version}`);
@@ -398,10 +398,10 @@ export class XetBlob extends Blob {
398398
}
399399

400400
if (uncompressed.length) {
401-
debug("yield", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead, stored);
401+
log("yield", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead, stored);
402402
totalBytesRead += uncompressed.length;
403403
yield stored ? uncompressed.slice() : uncompressed;
404-
debug("yielded", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead);
404+
log("yielded", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead);
405405
}
406406
}
407407

@@ -410,7 +410,7 @@ export class XetBlob extends Blob {
410410
}
411411
}
412412

413-
debug("done", done, "total read", totalBytesRead);
413+
log("done", done, "total read", totalBytesRead);
414414

415415
// Release the reader
416416
await reader.cancel();

0 commit comments

Comments
 (0)