Skip to content

Commit a176e5f

Browse files
durkmurderAlexander Hentschel
andauthored
Apply suggestions from code review
Co-authored-by: Alexander Hentschel <[email protected]>
1 parent 2adf27a commit a176e5f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

engine/common/follower/engine.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func (e *Engine) Process(channel channels.Channel, originID flow.Identifier, mes
184184
}
185185

186186
// processBlocksLoop processes available blocks as they are queued.
187+
// Implements `component.ComponentWorker` signature.
187188
func (e *Engine) processBlocksLoop(ctx irrecoverable.SignalerContext, ready component.ReadyFunc) {
188189
ready()
189190

@@ -215,7 +216,11 @@ func (e *Engine) processQueuedBlocks(doneSignal <-chan struct{}) error {
215216
}
216217

217218
msg, ok := e.pendingBlocks.Pop()
218-
if ok {
219+
if !ok {
220+
// when there are no more messages in the queue, back to the processBlocksLoop to wait
221+
// for the next incoming message to arrive.
222+
return nil
223+
}
219224
batch := msg.(flow.Slashable[[]*messages.BlockProposal])
220225
if len(batch.Message) < 1 {
221226
continue

0 commit comments

Comments
 (0)