log final counts when process completes
This commit is contained in:
parent
b5d31748e0
commit
e50bd160fe
@ -183,13 +183,17 @@ func (p *Publisher) checkBatchSize(tx *sqlx.Tx, maxBatchSize uint) (*sqlx.Tx, er
|
|||||||
return tx, nil
|
return tx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// printNodeCounters prints number of node processed.
|
// logNodeCounters periodically logs the number of node processed.
|
||||||
func (p *Publisher) printNodeCounters() {
|
func (p *Publisher) logNodeCounters() {
|
||||||
t := time.NewTicker(logInterval)
|
t := time.NewTicker(logInterval)
|
||||||
for range t.C {
|
for range t.C {
|
||||||
logrus.Infof("total runtime: %s", time.Now().Sub(p.startTime).String())
|
p.printNodeCounters()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Publisher) printNodeCounters() {
|
||||||
|
logrus.Infof("runtime: %s", time.Now().Sub(p.startTime).String())
|
||||||
logrus.Infof("processed state nodes: %d", atomic.LoadUint64(&p.stateNodeCounter))
|
logrus.Infof("processed state nodes: %d", atomic.LoadUint64(&p.stateNodeCounter))
|
||||||
logrus.Infof("processed storage nodes: %d", atomic.LoadUint64(&p.storageNodeCounter))
|
logrus.Infof("processed storage nodes: %d", atomic.LoadUint64(&p.storageNodeCounter))
|
||||||
logrus.Infof("processed code nodes: %d", atomic.LoadUint64(&p.codeNodeCounter))
|
logrus.Infof("processed code nodes: %d", atomic.LoadUint64(&p.codeNodeCounter))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -136,8 +136,10 @@ func (s *Service) createSnapshot(it trie.NodeIterator, trieDB *trie.Database, he
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
go s.ipfsPublisher.printNodeCounters()
|
go s.ipfsPublisher.logNodeCounters()
|
||||||
defer func() {
|
defer func() {
|
||||||
|
logrus.Info("----- final counts -----")
|
||||||
|
s.ipfsPublisher.printNodeCounters()
|
||||||
if rec := recover(); rec != nil {
|
if rec := recover(); rec != nil {
|
||||||
shared.Rollback(tx)
|
shared.Rollback(tx)
|
||||||
panic(rec)
|
panic(rec)
|
||||||
|
Loading…
Reference in New Issue
Block a user