Measure duration of mempool sync
This commit is contained in:
parent
7185060f62
commit
ed47171406
@ -3,6 +3,7 @@ package bchain
|
|||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
@ -39,7 +40,8 @@ func (m *Mempool) updateMaps(newScriptToTx map[string][]string, newTxToScript ma
|
|||||||
// Resync is not reentrant, it should be called from a single thread.
|
// Resync is not reentrant, it should be called from a single thread.
|
||||||
// Read operations (GetTransactions) are safe.
|
// Read operations (GetTransactions) are safe.
|
||||||
func (m *Mempool) Resync() error {
|
func (m *Mempool) Resync() error {
|
||||||
glog.Info("Mempool: resync")
|
start := time.Now()
|
||||||
|
glog.V(1).Info("Mempool: resync")
|
||||||
txs, err := m.chain.GetMempool()
|
txs, err := m.chain.GetMempool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -68,6 +70,6 @@ func (m *Mempool) Resync() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.updateMaps(newScriptToTx, newTxToScript)
|
m.updateMaps(newScriptToTx, newTxToScript)
|
||||||
glog.Info("Mempool: resync finished, ", len(m.txToScript), " transactions in mempool")
|
glog.Info("Mempool: resync finished in ", time.Since(start), ", ", len(m.txToScript), " transactions in mempool")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user