Skip to content

Commit d559933

Browse files
committed
remove logging altogether
1 parent d88fa83 commit d559933

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

packages/hub/src/utils/XetBlob.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ interface ChunkHeader {
7878
const CHUNK_HEADER_BYTES = 8;
7979

8080
// eslint-disable-next-line @typescript-eslint/no-unused-vars
81-
const debug = (...args: unknown[]) => {};
8281

8382
/**
8483
* XetBlob is a blob implementation that fetches data directly from the Xet storage
@@ -153,7 +152,6 @@ export class XetBlob extends Blob {
153152
this.#reconstructionInfoPromise = (async () => {
154153
const connParams = await getAccessToken(this.repoId, this.accessToken, this.fetch, this.hubUrl);
155154

156-
// debug(
157155
// `curl '${connParams.casUrl}/reconstruction/${this.hash}' -H 'Authorization: Bearer ${connParams.accessToken}'`
158156
// );
159157

@@ -220,15 +218,14 @@ export class XetBlob extends Blob {
220218
const termRanges = rangeList.getRanges(term.range.start, term.range.end);
221219

222220
if (termRanges.every((range) => range.data)) {
223-
debug("all data available for term", term.hash, readBytesToSkip);
224221
rangeLoop: for (const range of termRanges) {
225222
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
226223
for (let chunk of range.data!) {
227224
if (chunk.length > maxBytes - totalBytesRead) {
228225
chunk = chunk.slice(0, maxBytes - totalBytesRead);
229226
}
230227
totalBytesRead += chunk.length;
231-
debug("yield", chunk.length, "bytes", "total read", totalBytesRead);
228+
232229
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
233230
// if there's more than one range for the same term
234231
yield range.refCount > 1 ? chunk.slice() : chunk;
@@ -253,10 +250,6 @@ export class XetBlob extends Blob {
253250
);
254251
}
255252

256-
debug("term", term);
257-
debug("fetchinfo", fetchInfo);
258-
debug("readBytesToSkip", readBytesToSkip);
259-
260253
let resp = await customFetch(fetchInfo.url, {
261254
headers: {
262255
Range: `bytes=${fetchInfo.url_range.start}-${fetchInfo.url_range.end}`,
@@ -292,8 +285,6 @@ export class XetBlob extends Blob {
292285
const result = await reader.read();
293286
done = result.done;
294287

295-
debug("read", result.value?.length, "bytes", "total read", totalBytesRead, "toSkip", readBytesToSkip);
296-
297288
if (!result.value) {
298289
continue;
299290
}
@@ -318,8 +309,6 @@ export class XetBlob extends Blob {
318309
uncompressed_length: header.getUint8(5) | (header.getUint8(6) << 8) | (header.getUint8(7) << 16),
319310
};
320311

321-
debug("chunk header", chunkHeader, "to skip", readBytesToSkip);
322-
323312
if (chunkHeader.version !== 0) {
324313
throw new Error(`Unsupported chunk version ${chunkHeader.version}`);
325314
}
@@ -380,10 +369,8 @@ export class XetBlob extends Blob {
380369
}
381370

382371
if (uncompressed.length) {
383-
debug("yield", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead, stored);
384372
totalBytesRead += uncompressed.length;
385373
yield stored ? uncompressed.slice() : uncompressed;
386-
debug("yielded", uncompressed.length, "bytes", result.value.length, "total read", totalBytesRead);
387374
}
388375
}
389376

@@ -392,8 +379,6 @@ export class XetBlob extends Blob {
392379
}
393380
}
394381

395-
debug("done", done, "total read", totalBytesRead);
396-
397382
// Release the reader
398383
await reader.cancel();
399384
}

0 commit comments

Comments
 (0)