From 57ace4cd7c8a7771b955bc78afe8987791e7440b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Ram=C3=ADrez?= Date: Tue, 13 Aug 2024 10:47:12 +0200 Subject: [PATCH] fix loop --- aggregator/aggregator.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index fe3b149..e693064 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -182,6 +182,8 @@ func New( witnessRetrievalChan: make(chan *state.DBBatch, cfg.MaxWitnessRetrievalWorkers), } + log.Infof("MaxWitnessRetrievalWorkers set to %d", cfg.MaxWitnessRetrievalWorkers) + // Set function to handle the batches from the data stream a.streamClient.SetProcessEntryFunc(a.handleReceivedDataStream) a.l1Syncr.SetCallbackOnReorgDone(a.handleReorg) @@ -190,11 +192,13 @@ func New( } func (a *Aggregator) retrieveWitnesses() { - select { - case <-a.ctx.Done(): - return - case dbBatch := <-a.witnessRetrievalChan: - go a.retrieveWitness(dbBatch) + for { + select { + case <-a.ctx.Done(): + return + case dbBatch := <-a.witnessRetrievalChan: + go a.retrieveWitness(dbBatch) + } } }