From eff27e646c8a1e3b74c8ae33612e90eff4ab5801 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Thu, 23 Mar 2023 10:23:51 +0530 Subject: [PATCH 1/3] Add paralleExecute index to logs --- dist/restore/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dist/restore/index.js b/dist/restore/index.js index 3a855e4..73898ca 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -28332,6 +28332,7 @@ class Batch { } this.concurrency = concurrency; this.emitter = new events.EventEmitter(); + this.index = 0; } /** * Add a operation into queue. @@ -28385,6 +28386,7 @@ class Batch { * */ parallelExecute() { + const local_index = this.index++; if (this.state === BatchStates.Error) { return; } @@ -28395,7 +28397,9 @@ class Batch { while (this.actives < this.concurrency) { const operation = this.nextOperation(); if (operation) { + console.log(`parallelExecute ${local_index} starting execution of operation ${this.operation}. Active count: ${this.actives}`); operation(); + console.log(`parallelExecute ${local_index} finished execution of operation ${this.operation}. Active count: ${this.actives}`); } else { return; From 938b48413067f3b24c6ce664d5f366c55f3d6557 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Thu, 23 Mar 2023 16:59:47 +0530 Subject: [PATCH 2/3] add more logs --- dist/restore/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index 73898ca..98c210b 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -28387,6 +28387,7 @@ class Batch { */ parallelExecute() { const local_index = this.index++; + console.log(`parallelExecute ${local_index} Active count: ${this.actives} Completed count: ${this.completed} total: ${this.operations.length}`); if (this.state === BatchStates.Error) { return; } @@ -28397,9 +28398,8 @@ class Batch { while (this.actives < this.concurrency) { const operation = this.nextOperation(); if (operation) { - console.log(`parallelExecute ${local_index} starting execution of operation ${this.operation}. Active count: ${this.actives}`); + console.log(`parallelExecute ${local_index} starting execution of operation ${this.offset}. Active count: ${this.actives}`); operation(); - console.log(`parallelExecute ${local_index} finished execution of operation ${this.operation}. Active count: ${this.actives}`); } else { return; From 8f35dac68eaeb154c553d9e3c55b0da36fd67d17 Mon Sep 17 00:00:00 2001 From: Bishal Prasad Date: Thu, 23 Mar 2023 22:26:57 +0530 Subject: [PATCH 3/3] streamToBuffer logging --- dist/restore/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index 98c210b..895a13f 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -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);