Skip to content

Commit

Permalink
no waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed May 21, 2024
1 parent c6acdfd commit 76882b8
Showing 1 changed file with 45 additions and 7 deletions.
52 changes: 45 additions & 7 deletions rollup/cmd/rollup_relayer/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,51 @@ func action(ctx *cli.Context) error {
l2watcher.TryFetchRunningMissingBlocks(number)
})

go utils.Loop(subCtx, 2*time.Second, chunkProposer.TryProposeChunk)

go utils.Loop(subCtx, 10*time.Second, batchProposer.TryProposeBatch)

go utils.Loop(subCtx, 2*time.Second, l2relayer.ProcessPendingBatches)

go utils.Loop(subCtx, 15*time.Second, l2relayer.ProcessCommittedBatches)
go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
default:
chunkProposer.TryProposeChunk()
}
}
}(subCtx)

go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
default:
batchProposer.TryProposeBatch()
}
}
}(subCtx)

go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
default:
l2relayer.ProcessPendingBatches()
time.Sleep(2 * time.Second)
}
}
}(subCtx)

go func(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
default:
l2relayer.ProcessCommittedBatches()
time.Sleep(15 * time.Second)
}
}
}(subCtx)

// Finish start all rollup relayer functions.
log.Info("Start rollup-relayer successfully", "version", version.Version)
Expand Down

0 comments on commit 76882b8

Please sign in to comment.