fix: account for the artificially added delay in commit stage (#806)

* fix: account for the artificially added delay in commit stage

* linter

* chore: auto version bump [bot]

---------

Co-authored-by: omerfirmak <omerfirmak@users.noreply.github.com>
This commit is contained in:
Ömer Faruk Irmak 2024-06-07 10:39:05 +03:00 committed by GitHub
parent ccf6321b92
commit dc57ae2468
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -681,8 +681,9 @@ func (e retryableCommitError) Unwrap() error {
// commit runs any post-transaction state modifications, assembles the final block
// and commits new work if consensus engine is running.
func (w *worker) commit(res *pipeline.Result) error {
sealDelay := time.Duration(0)
defer func(t0 time.Time) {
l2CommitTimer.Update(time.Since(t0))
l2CommitTimer.Update(time.Since(t0) - sealDelay)
}(time.Now())
if res.CCCErr != nil {
@ -709,8 +710,11 @@ func (w *worker) commit(res *pipeline.Result) error {
return err
}
// Clique.Seal() will only wait for a second before giving up on us. So make sure there is nothing computational heavy
// or a call that blocks between the call to Seal and the line below
// or a call that blocks between the call to Seal and the line below. Seal might introduce some delay, so we keep track of
// that artificially added delay and subtract it from overall runtime of commit().
sealStart := time.Now()
block = <-resultCh
sealDelay = time.Since(sealStart)
if block == nil {
return errors.New("missed seal response from consensus engine")
}

View file

@ -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 = 38 // Patch version component of the current release
VersionPatch = 39 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)