mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-28 17:31:08 -05:00
streamToBuffer logging
This commit is contained in:
parent
938b484130
commit
8f35dac68e
1 changed files with 8 additions and 1 deletions
9
dist/restore/index.js
vendored
9
dist/restore/index.js
vendored
|
@ -28837,15 +28837,21 @@ async function streamToBuffer(stream, buffer, offset, end, encoding) {
|
|||
let pos = 0; // Position in stream
|
||||
const count = end - offset; // Total amount of data needed in stream
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeout = setTimeout(() => reject(new Error(`The operation cannot be completed in timeout.`)), REQUEST_TIMEOUT);
|
||||
const timeout = setTimeout(() => {
|
||||
console.log("Timeout triggered.");
|
||||
return reject(new Error(`The operation cannot be completed in timeout.`));
|
||||
}, REQUEST_TIMEOUT);
|
||||
stream.on("readable", () => {
|
||||
console.log("Entering readable");
|
||||
if (pos >= count) {
|
||||
clearTimeout(timeout);
|
||||
console.log("Leaving readable");
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
let chunk = stream.read();
|
||||
if (!chunk) {
|
||||
console.log("Leaving readable");
|
||||
return;
|
||||
}
|
||||
if (typeof chunk === "string") {
|
||||
|
@ -28855,6 +28861,7 @@ async function streamToBuffer(stream, buffer, offset, end, encoding) {
|
|||
const chunkLength = pos + chunk.length > count ? count - pos : chunk.length;
|
||||
buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);
|
||||
pos += chunkLength;
|
||||
console.log("Leaving readable");
|
||||
});
|
||||
stream.on("end", () => {
|
||||
clearTimeout(timeout);
|
||||
|
|
Loading…
Reference in a new issue