Commit 25592ec7 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] #1325 Allow to have up to 10 chunks of advance compared to apply during sync

parent 43fa0c25
......@@ -32,6 +32,7 @@ export const CrawlerConstants = {
SANDBOX_CHECK_INTERVAL: 48, // Every 4 hours (288 blocks a day / 24 * 4)
TEST_PEERS_INTERVAL: 10, // In seconds
SYNC_PEERS_INTERVAL: 3, // Every 3 block average generation time
SYNC_CHUNKS_IN_ADVANCE: 10, // We want to have that much chunks in advance when syncing
DURATIONS: {
TEN_SECONDS: 10,
......
......@@ -132,13 +132,10 @@ export class DownloadStream extends Duplex {
delete this.chunks[this.currentChunkNumber]
// Let's start the download of next chunk
this.currentChunkNumber++
this.downloadChunk(this.currentChunkNumber)
.then(() => this.downloadChunk(this.currentChunkNumber + 1))
.then(() => this.downloadChunk(this.currentChunkNumber + 2))
.then(() => this.downloadChunk(this.currentChunkNumber + 3))
.then(() => this.downloadChunk(this.currentChunkNumber + 4))
.then(() => this.downloadChunk(this.currentChunkNumber + 5))
.then(() => this.downloadChunk(this.currentChunkNumber + 6))
let p = this.downloadChunk(this.currentChunkNumber)
for (let i = 1; i <= CrawlerConstants.SYNC_CHUNKS_IN_ADVANCE; i++) {
p = p.then(() => this.downloadChunk(this.currentChunkNumber + i))
}
}
else {
// We don't have it yet
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment