Skip to content
Snippets Groups Projects
Commit 511d2047 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix: #1430 sync is keeping chunks in memory

parent 10a823de
No related branches found
No related tags found
1 merge request!1400Resolve "`sync` uses too much RAM, even without GVA enabled"
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment