From c72c0be8b5ede03fd1ce5eee019daf5090a3757b Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Tue, 31 Dec 2024 18:28:29 +0700 Subject: [PATCH] Set workers only from one sync (#13284) --- eth/stagedsync/exec3.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 0c8c06fbe23..67516febd4a 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -206,6 +206,8 @@ func ExecV3(ctx context.Context, initialCycle bool, isMining bool, ) error { + inMemExec := txc.Doms != nil + // TODO: e35 doesn't support parallel-exec yet parallel = false //nolint if parallel && cfg.chainConfig.ChainName == networkname.Gnosis { @@ -237,16 +239,17 @@ func ExecV3(ctx context.Context, } } agg := cfg.db.(state2.HasAgg).Agg().(*state2.Aggregator) - if initialCycle { - agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) - agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) - } else { - agg.SetCompressWorkers(1) - agg.SetCollateAndBuildWorkers(1) + if !inMemExec && !isMining { + if initialCycle { + agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) + agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) + } else { + agg.SetCompressWorkers(1) + agg.SetCollateAndBuildWorkers(1) + } } var err error - inMemExec := txc.Doms != nil var doms *state2.SharedDomains if inMemExec { doms = txc.Doms