From 2af7547fe046d27260b7ab9e5a5be81ea1d136d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CGheisMohammadi=E2=80=9D?= <36589218+GheisMohammadi@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:09:33 +0800 Subject: [PATCH] refactor fixValues function, put priority on MinStreams rather than Concurrency --- api/service/stagedstreamsync/const.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/api/service/stagedstreamsync/const.go b/api/service/stagedstreamsync/const.go index 5c735d764b..ab4dfd2b2f 100644 --- a/api/service/stagedstreamsync/const.go +++ b/api/service/stagedstreamsync/const.go @@ -23,9 +23,6 @@ const ( // no more request will be assigned to workers to wait for InsertChain to finish. SoftQueueCap int = 100 - // DefaultConcurrency is the default settings for concurrency - DefaultConcurrency int = 4 - // ShortRangeTimeout is the timeout for each short range sync, which allow short range sync // to restart automatically when stuck in `getBlockHashes` ShortRangeTimeout time.Duration = 1 * time.Minute @@ -74,10 +71,10 @@ type ( func (c *Config) fixValues() { if c.Concurrency == 0 { - c.Concurrency = DefaultConcurrency + c.Concurrency = c.MinStreams } if c.Concurrency > c.MinStreams { - c.MinStreams = c.Concurrency + c.Concurrency = c.MinStreams } if c.MinStreams > c.InitStreams { c.InitStreams = c.MinStreams