Skip to content

Commit

Permalink
fix: reset recheckTimeMs (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinsan-line authored Oct 28, 2020
1 parent fa2c02d commit 3d69e4c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,16 +570,12 @@ func (mem *CListMempool) Update(

// Either recheck non-committed txs to see if they became invalid
// or just notify there're some txs left.
recheckStartTime := time.Now().UnixNano()
if mem.Size() > 0 {
if mem.config.Recheck {
mem.logger.Info("Recheck txs", "numtxs", mem.Size(), "height", height)

recheckStartTime := time.Now().UnixNano()
mem.recheckTxs()
recheckEndTime := time.Now().UnixNano()

recheckTimeMs := float64(recheckEndTime-recheckStartTime) / 1000000
mem.metrics.RecheckingTime.Set(recheckTimeMs)

// At this point, mem.txs are being rechecked.
// mem.recheckCursor re-scans mem.txs and possibly removes some txs.
Expand All @@ -588,6 +584,10 @@ func (mem *CListMempool) Update(
mem.notifyTxsAvailable()
}
}
recheckEndTime := time.Now().UnixNano()

recheckTimeMs := float64(recheckEndTime-recheckStartTime) / 1000000
mem.metrics.RecheckingTime.Set(recheckTimeMs)

// Update metrics
mem.metrics.Size.Set(float64(mem.Size()))
Expand Down

0 comments on commit 3d69e4c

Please sign in to comment.