Skip to content

Commit

Permalink
fix: use a named deadline timer in CCC stage (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak authored May 30, 2024
1 parent ab349d6 commit 094a67a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 28 // Patch version component of the current release
VersionPatch = 29 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
6 changes: 3 additions & 3 deletions rollup/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,16 @@ func (p *Pipeline) cccStage(candidates <-chan *BlockCandidate, deadline time.Tim
var deadlineReached bool

go func() {
deadlineTimer := time.NewTimer(time.Until(deadline))
defer func() {
close(resultCh)
deadlineTimer.Stop()
lifetimeTimer.UpdateSince(p.start)
}()
for {
idleStart := time.Now()
select {
case <-time.After(time.Until(deadline)):
case <-deadlineTimer.C:
cccIdleTimer.UpdateSince(idleStart)
// note: currently we don't allow empty blocks, but if we ever do; make sure to CCC check it first
if lastCandidate != nil {
Expand All @@ -328,8 +330,6 @@ func (p *Pipeline) cccStage(candidates <-chan *BlockCandidate, deadline time.Tim
return
}
deadlineReached = true
// avoid deadline case being triggered again and again
deadline = time.Now().Add(time.Hour)
case candidate := <-candidates:
cccIdleTimer.UpdateSince(idleStart)
cccStart := time.Now()
Expand Down

0 comments on commit 094a67a

Please sign in to comment.