defer time.Since

This commit is contained in:
Daniel Liu 2023-11-01 12:43:50 +08:00
parent 0a6fa8eda0
commit 349f71db7b
3 changed files with 11 additions and 6 deletions

View file

@ -944,9 +944,10 @@ func (pool *LendingPool) removeTx(hash common.Hash) {
// future queue to the set of pending transactions. During this process, all
// invalidated transactions (low nonce, low balance) are deleted.
func (pool *LendingPool) promoteExecutables(accounts []common.Address) {
start := time.Now()
log.Debug("start promoteExecutables")
defer log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
defer func(start time.Time) {
log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
}(time.Now())
// Gather all the accounts potentially needing updates
if accounts == nil {
accounts = make([]common.Address, 0, len(pool.queue))

View file

@ -859,8 +859,10 @@ func (pool *OrderPool) removeTx(hash common.Hash) {
// future queue to the set of pending transactions. During this process, all
// invalidated transactions (low nonce, low balance) are deleted.
func (pool *OrderPool) promoteExecutables(accounts []common.Address) {
start := time.Now()
defer log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
defer func(start time.Time) {
log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
}(time.Now())
// Gather all the accounts potentially needing updates
if accounts == nil {
accounts = make([]common.Address, 0, len(pool.queue))

View file

@ -1045,9 +1045,11 @@ func (pool *TxPool) removeTx(hash common.Hash) {
// future queue to the set of pending transactions. During this process, all
// invalidated transactions (low nonce, low balance) are deleted.
func (pool *TxPool) promoteExecutables(accounts []common.Address) {
start := time.Now()
log.Debug("start promoteExecutables")
defer log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
defer func(start time.Time) {
log.Debug("end promoteExecutables", "time", common.PrettyDuration(time.Since(start)))
}(time.Now())
// Gather all the accounts potentially needing updates
if accounts == nil {
accounts = make([]common.Address, 0, len(pool.queue))