From 83c35833553e8d807b54b06c10321c69427d2aa0 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 25 Nov 2020 18:25:25 +0800 Subject: [PATCH] cleanup --- cmd/geth/usage.go | 1 + statediff/service.go | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index e3b52daa1..3acd40145 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -242,6 +242,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{ utils.StateDiffDBNodeIDFlag, utils.StateDiffDBClientNameFlag, utils.StateDiffWritingFlag, + utils.StateDiffWorkersFlag, }, }, { diff --git a/statediff/service.go b/statediff/service.go index e36ef4428..2f16fc4ab 100644 --- a/statediff/service.go +++ b/statediff/service.go @@ -276,11 +276,11 @@ func (sds *Service) writeLoopWorker(params workerParams) { // TODO: how to handle with concurrent workers statediffMetrics.lastStatediffHeight.Update(int64(currentBlock.Number().Uint64())) case err := <-params.errCh: - log.Warn("Error from chain event subscription", "error", err) + log.Warn("Error from chain event subscription", "error", err, "worker", params.id) sds.close() return case <-sds.QuitChan: - log.Info("Quitting the statediff writing process") + log.Info("Quitting the statediff writing process", "worker", params.id) sds.close() return } @@ -480,11 +480,8 @@ func (sds *Service) Unsubscribe(id rpc.ID) error { func (sds *Service) Start() error { log.Info("Starting statediff service") - { - // TODO: also use worker pool here? - chainEventCh := make(chan core.ChainEvent, chainEventChanSize) - go sds.Loop(chainEventCh) - } + chainEventCh := make(chan core.ChainEvent, chainEventChanSize) + go sds.Loop(chainEventCh) if sds.enableWriteLoop { log.Info("Starting statediff DB write loop", "params", writeLoopParams)