Skip to content

Commit 7007f9a

Browse files
authored
fix(syncer): skip bumping height when event dropped (#2670)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview Catched by @alpe, events are being dropped, we should just skip bumping the height and retry next time. <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> -->
1 parent 54aadd1 commit 7007f9a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

block/internal/syncing/syncer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ func (s *Syncer) syncLoop() {
252252
var nextDARequestAt time.Time
253253

254254
//TODO: we should request to see what the head of the chain is at, then we know if we are falling behinf or in sync mode
255+
syncLoop:
255256
for {
256257
select {
257258
case <-s.ctx.Done():
@@ -284,12 +285,15 @@ func (s *Syncer) syncLoop() {
284285
} else if len(events) > 0 {
285286
// Reset backoff on success
286287
nextDARequestAt = time.Time{}
288+
287289
// Process DA events
288290
for _, event := range events {
289291
select {
290292
case s.heightInCh <- event:
291293
default:
292294
s.logger.Warn().Msg("height channel full, dropping DA event")
295+
time.Sleep(10 * time.Millisecond)
296+
continue syncLoop
293297
}
294298
}
295299

@@ -311,8 +315,11 @@ func (s *Syncer) syncLoop() {
311315
case s.heightInCh <- event:
312316
default:
313317
s.logger.Warn().Msg("height channel full, dropping P2P header event")
318+
time.Sleep(10 * time.Millisecond)
319+
continue syncLoop
314320
}
315321
}
322+
316323
lastHeaderHeight = newHeaderHeight
317324
}
318325
processedP2P = true
@@ -325,6 +332,8 @@ func (s *Syncer) syncLoop() {
325332
case s.heightInCh <- event:
326333
default:
327334
s.logger.Warn().Msg("height channel full, dropping P2P data event")
335+
time.Sleep(10 * time.Millisecond)
336+
continue syncLoop
328337
}
329338
}
330339
lastDataHeight = newDataHeight

0 commit comments

Comments
 (0)