Skip to content

Commit e717aa2

Browse files
authored
Merge branch 'main' into julien/simplify-store
2 parents 0588001 + 850a82f commit e717aa2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/sync/sync_service.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,14 @@ func (syncService *SyncService[H]) initFromP2PWithRetry(ctx context.Context, pee
355355
return true, nil
356356
}
357357

358-
// block with exponential backoff until initialization succeeds or context is canceled.
358+
// block with exponential backoff until initialization succeeds, context is canceled, or timeout.
359+
// If timeout is reached, we return nil to allow startup to continue - DA sync will
360+
// provide headers and WriteToStoreAndBroadcast will lazily initialize the store/syncer.
359361
backoff := 1 * time.Second
360362
maxBackoff := 10 * time.Second
361363

362-
timeoutTimer := time.NewTimer(time.Minute * 10)
364+
p2pInitTimeout := 30 * time.Second
365+
timeoutTimer := time.NewTimer(p2pInitTimeout)
363366
defer timeoutTimer.Stop()
364367

365368
for {
@@ -374,7 +377,10 @@ func (syncService *SyncService[H]) initFromP2PWithRetry(ctx context.Context, pee
374377
case <-ctx.Done():
375378
return ctx.Err()
376379
case <-timeoutTimer.C:
377-
return fmt.Errorf("timeout reached while trying to initialize the store after 10 minutes: %w", err)
380+
syncService.logger.Warn().
381+
Dur("timeout", p2pInitTimeout).
382+
Msg("P2P header sync initialization timed out, deferring to DA sync")
383+
return nil
378384
case <-time.After(backoff):
379385
}
380386

0 commit comments

Comments
 (0)