Skip to content

Commit

Permalink
decouple Check() blocking behaviour from stream.Go()'s
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Sep 2, 2024
1 parent 6abc581 commit 07f3faf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rollup/ccc/async_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ func (c *AsyncChecker) Check(block *types.Block) error {
// all blocks in the same fork share the same context to allow terminating them all at once if needed
ctx, ctxCancelFunc := c.forkCtx, c.forkCtxCancelFunc
c.workers.Go(func() stream.Callback {
return c.checkerTask(block, checker, ctx, ctxCancelFunc)
taskCb := c.checkerTask(block, checker, ctx, ctxCancelFunc)
return func() {
taskCb()
c.freeCheckers <- checker
}
})
return nil
}
Expand All @@ -133,7 +137,6 @@ func (c *AsyncChecker) checkerTask(block *types.Block, ccc *Checker, forkCtx con
checkStart := time.Now()
defer func() {
checkTimer.UpdateSince(checkStart)
c.freeCheckers <- ccc
activeWorkersGauge.Dec(1)
}()

Expand Down

0 comments on commit 07f3faf

Please sign in to comment.