From fa26f7820dcf3f9c65afc5187c212cfd451fcfa7 Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Sun, 6 Aug 2017 17:26:12 +0200 Subject: [PATCH] [fix] #1036 Pull sandboxes from the network 10 minutes after the start --- app/modules/crawler/lib/constants.ts | 1 + app/modules/crawler/lib/crawler.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/modules/crawler/lib/constants.ts b/app/modules/crawler/lib/constants.ts index 23ca184d4..c8076b899 100644 --- a/app/modules/crawler/lib/constants.ts +++ b/app/modules/crawler/lib/constants.ts @@ -12,6 +12,7 @@ export const CrawlerConstants = { PULLING_MINIMAL_DELAY: 20, PULLING_INTERVAL_TARGET: 240, COUNT_FOR_ENOUGH_PEERS: 4, + SANDBOX_FIRST_PULL_DELAY: 1000 * 60 * 10, // milliseconds SANDBOX_PEERS_COUNT: 2, SANDBOX_CHECK_INTERVAL: 288, // Every day (288 blocks = 1 day) TEST_PEERS_INTERVAL: 10, // In seconds diff --git a/app/modules/crawler/lib/crawler.ts b/app/modules/crawler/lib/crawler.ts index 494960a47..370ce2451 100644 --- a/app/modules/crawler/lib/crawler.ts +++ b/app/modules/crawler/lib/crawler.ts @@ -168,6 +168,9 @@ export class SandboxCrawler implements DuniterService { if (this.pullInterval) clearInterval(this.pullInterval); this.pullInterval = setInterval(() => this.pullFifo.push((cb:any) => this.sandboxPull(this.server).then(cb).catch(cb)), 1000 * this.conf.avgGenTime * CrawlerConstants.SANDBOX_CHECK_INTERVAL); + setTimeout(() => { + this.pullFifo.push((cb:any) => this.sandboxPull(this.server).then(cb).catch(cb)) + }, CrawlerConstants.SANDBOX_FIRST_PULL_DELAY) } async stopService() { -- GitLab