Skip to content

Commit

Permalink
Fixed issues where time-to-seal was NaN (#6625)
Browse files Browse the repository at this point in the history
* Fixed issues where time-to-seal was NaN

* Always remove record at the end
  • Loading branch information
AndriiDiachuk authored Nov 8, 2024
1 parent 6ad6fcc commit 4162017
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions module/metrics/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,6 @@ func (tc *TransactionCollector) TransactionFinalized(txID flow.Identifier, when

tc.trackTTF(t, tc.logTimeToFinalized)
tc.trackTTFE(t, tc.logTimeToFinalizedExecuted)

// remove transaction timing from mempool if finalized and executed
if !t.Finalized.IsZero() && !t.Executed.IsZero() {
tc.transactionTimings.Remove(txID)
}
}

func (tc *TransactionCollector) TransactionExecuted(txID flow.Identifier, when time.Time) {
Expand All @@ -280,11 +275,6 @@ func (tc *TransactionCollector) TransactionExecuted(txID flow.Identifier, when t

tc.trackTTE(t, tc.logTimeToExecuted)
tc.trackTTFE(t, tc.logTimeToFinalizedExecuted)

// remove transaction timing from mempool if finalized and executed
if !t.Finalized.IsZero() && !t.Executed.IsZero() {
tc.transactionTimings.Remove(txID)
}
}

func (tc *TransactionCollector) TransactionSealed(txID flow.Identifier, when time.Time) {
Expand All @@ -302,10 +292,8 @@ func (tc *TransactionCollector) TransactionSealed(txID flow.Identifier, when tim

tc.trackTTS(t, tc.logTimeToSealed)

// remove transaction timing from mempool if sealed
if !t.Sealed.IsZero() {
tc.transactionTimings.Remove(txID)
}
// remove transaction timing from mempool
tc.transactionTimings.Remove(txID)
}

func (tc *TransactionCollector) trackTTF(t *flow.TransactionTiming, log bool) {
Expand Down

0 comments on commit 4162017

Please sign in to comment.