Skip to content

Commit

Permalink
fix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Aug 13, 2024
1 parent 9c639f1 commit 57ace4c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
}

Expand Down

0 comments on commit 57ace4c

Please sign in to comment.