Skip to content
Snippets Groups Projects
Commit 66e5fc2e authored by Éloïs's avatar Éloïs
Browse files

Merge branch '1430-sync-uses-too-much-ram-even-without-gva-enabled' into 'dev'

Resolve "`sync` uses too much RAM, even without GVA enabled"

Closes #1430

See merge request !1400
parents 10a823de 511d2047
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 { ...@@ -156,7 +156,11 @@ export class DownloadStream extends Duplex {
// Asks for next chunk: do we have it? // Asks for next chunk: do we have it?
if (this.chunks[this.currentChunkNumber]) { if (this.chunks[this.currentChunkNumber]) {
this.push(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 // Let's start the download of next chunk
this.currentChunkNumber++; this.currentChunkNumber++;
let p = this.downloadChunk(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