Skip to content

Commit

Permalink
Print less logs
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Oct 23, 2024
1 parent c63804a commit 2490701
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zk/stages/stage_batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ func SpawnStageBatches(
// if no blocks available should block
// if download routine finished, should continue to read from channel until it's empty
// if both download routine stopped and channel empty - stop loop

timeoutCtx, cancelTimeout := context.WithTimeout(ctx, cfg.zkCfg.SequencerBatchSealTime)
defer cancelTimeout()

select {
case entry := <-*entryChan:
if restartDatastreamBlock, endLoop, unwound, err = batchProcessor.ProcessEntry(entry); err != nil {
Expand All @@ -259,8 +263,8 @@ func SpawnStageBatches(
case <-ctx.Done():
log.Warn(fmt.Sprintf("[%s] Context done", logPrefix))
endLoop = true
default:
time.Sleep(10 * time.Millisecond)
case <-timeoutCtx.Done():
log.Warn(fmt.Sprintf("[%s] Timeout reached", logPrefix))
}

// if ds end reached check again for new blocks in the stream
Expand Down

0 comments on commit 2490701

Please sign in to comment.