From 6e52ad4a8855a43f10323767a668e39b02d2b7b7 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Tue, 8 Mar 2022 03:05:57 -0800 Subject: [PATCH] [downloader] adjust default testnet downloader values, add sleep to unsuccessful download --- cmd/harmony/default.go | 24 +++++++++---------- hmy/downloader/downloader.go | 1 + .../common/streammanager/streammanager.go | 1 + 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cmd/harmony/default.go b/cmd/harmony/default.go index cab19807d..97b8004e7 100644 --- a/cmd/harmony/default.go +++ b/cmd/harmony/default.go @@ -139,25 +139,25 @@ var ( defaultTestNetSyncConfig = harmonyconfig.SyncConfig{ Enabled: true, Downloader: false, - Concurrency: 4, - MinPeers: 4, - InitStreams: 4, - DiscSoftLowCap: 4, - DiscHardLowCap: 4, + Concurrency: 2, + MinPeers: 2, + InitStreams: 2, + DiscSoftLowCap: 2, + DiscHardLowCap: 2, DiscHighCap: 1024, - DiscBatch: 8, + DiscBatch: 3, } defaultLocalNetSyncConfig = harmonyconfig.SyncConfig{ Enabled: true, Downloader: true, - Concurrency: 4, - MinPeers: 4, - InitStreams: 4, - DiscSoftLowCap: 4, - DiscHardLowCap: 4, + Concurrency: 2, + MinPeers: 2, + InitStreams: 2, + DiscSoftLowCap: 2, + DiscHardLowCap: 2, DiscHighCap: 1024, - DiscBatch: 8, + DiscBatch: 3, } defaultElseSyncConfig = harmonyconfig.SyncConfig{ diff --git a/hmy/downloader/downloader.go b/hmy/downloader/downloader.go index f1e823659..4d955c8e2 100644 --- a/hmy/downloader/downloader.go +++ b/hmy/downloader/downloader.go @@ -203,6 +203,7 @@ func (d *Downloader) loop() { time.Sleep(5 * time.Second) trigger() }() + time.Sleep(1 * time.Second) continue } d.logger.Info().Int("block added", addedBN). diff --git a/p2p/stream/common/streammanager/streammanager.go b/p2p/stream/common/streammanager/streammanager.go index 508f90fd9..c040d7d34 100644 --- a/p2p/stream/common/streammanager/streammanager.go +++ b/p2p/stream/common/streammanager/streammanager.go @@ -125,6 +125,7 @@ func (sm *streamManager) loop() { case <-sm.discCh: if sm.coolDown.IsSet() { + sm.logger.Info().Msg("skipping discover for cool down") continue } if discCancel != nil {