Skip to content

Commit

Permalink
process historical blocks async
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Jan 16, 2024
1 parent 37cd80f commit 1fad84b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ func NewRelayer(
)
return nil, nil, err
}
sub.ProcessFromHeight(big.NewInt(0).SetUint64(height), doneProcessingMissedBlocks)
// Process historical blocks asynchronously so that the main processing loop can
// start processing new blocks as soon as possible. Otherwise, it's possible for
// ProcessFromHeight to overload the message queue and cause a deadlock.
go sub.ProcessFromHeight(big.NewInt(0).SetUint64(height), doneProcessingMissedBlocks)
} else {
err = r.setProcessedBlockHeightToLatest()
if err != nil {
Expand Down

0 comments on commit 1fad84b

Please sign in to comment.