diff --git a/app/modules/crawler/lib/sync/v2/DownloadStream.ts b/app/modules/crawler/lib/sync/v2/DownloadStream.ts index 496a55d3a3c49d06c70bb62cd29321a3b1cb87ac..a08a7c8dc192d9e8761c4f541e3744cb7305db9f 100644 --- a/app/modules/crawler/lib/sync/v2/DownloadStream.ts +++ b/app/modules/crawler/lib/sync/v2/DownloadStream.ts @@ -156,7 +156,11 @@ export class DownloadStream extends Duplex { // Asks for next chunk: do we have it? if (this.chunks[this.currentChunkNumber]) { this.push(this.chunks[this.currentChunkNumber]); - delete this.chunks[this.currentChunkNumber]; + const previousNumber = this.currentChunkNumber - 1; + if (previousNumber >= 0) { + // Delete the **previous**, not the current (because current would be downloaded again for chaining check) + delete this.chunks[previousNumber]; + } // Let's start the download of next chunk this.currentChunkNumber++; let p = this.downloadChunk(this.currentChunkNumber);