Skip to content

Commit e817ab6

Browse files
committed
add connection timeout
1 parent d86306b commit e817ab6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/sync/sync_service.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ func (syncService *SyncService[H]) initFromP2POnce(ctx context.Context, peerIDs
230230
heightToQuery = head.Height()
231231
}
232232

233-
trusted, err := syncService.ex.GetByHeight(ctx, heightToQuery)
233+
reqCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
234+
trusted, err := syncService.ex.GetByHeight(reqCtx, heightToQuery)
235+
cancel()
234236
if err != nil {
235237
syncService.logger.Info().Err(err).Msg("P2P init failed, deferring to DA sync")
236238
return nil

0 commit comments

Comments
 (0)