mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-24 20:47:16 +00:00
avoid NAN duration in logs (#3521)
This commit is contained in:
parent
6d9ea162ab
commit
7390ac8381
@ -314,7 +314,10 @@ Loop:
|
||||
totalGasTmp := new(big.Int).Set(totalGasUsed)
|
||||
elapsed := time.Since(startTime)
|
||||
estimateRatio := float64(cumulativeGas.Sub(cumulativeGas, startGasUsed).Uint64()) / float64(totalGasTmp.Sub(totalGasTmp, startGasUsed).Uint64())
|
||||
estimatedTime := common.PrettyDuration((elapsed.Seconds() / estimateRatio) * float64(time.Second))
|
||||
var estimatedTime common.PrettyDuration
|
||||
if estimateRatio != 0 {
|
||||
estimatedTime = common.PrettyDuration((elapsed.Seconds() / estimateRatio) * float64(time.Second))
|
||||
}
|
||||
logBlock, logTx, logTime = logProgress(logPrefix, logBlock, logTime, blockNum, logTx, lastLogTx, gas, estimatedTime, batch)
|
||||
gas = 0
|
||||
tx.CollectMetrics()
|
||||
@ -353,7 +356,9 @@ func logProgress(logPrefix string, prevBlock uint64, prevTime time.Time, current
|
||||
"blk/s", speed,
|
||||
"tx/s", speedTx,
|
||||
"Mgas/s", speedMgas,
|
||||
"estimated duration", estimatedTime,
|
||||
}
|
||||
if estimatedTime > 0 {
|
||||
logpairs = append(logpairs, "estimated duration", estimatedTime)
|
||||
}
|
||||
if batch != nil {
|
||||
logpairs = append(logpairs, "batch", common.StorageSize(batch.BatchSize()))
|
||||
|
Loading…
Reference in New Issue
Block a user