Skip to content
Snippets Groups Projects
Commit 6877d3bd authored by Levente Pap's avatar Levente Pap
Browse files

Fix DBStats method

parent 5ba853ec
No related branches found
No related tags found
No related merge requests found
...@@ -139,15 +139,15 @@ func (tangle *Tangle) Prune() error { ...@@ -139,15 +139,15 @@ func (tangle *Tangle) Prune() error {
func (tangle *Tangle) DBStats() (solidCount int, messageCount int, avgSolidificationTime float64) { func (tangle *Tangle) DBStats() (solidCount int, messageCount int, avgSolidificationTime float64) {
var sumSolidificationTime time.Duration var sumSolidificationTime time.Duration
tangle.messageMetadataStorage.ForEach(func(key []byte, cachedObject objectstorage.CachedObject) bool { tangle.messageMetadataStorage.ForEach(func(key []byte, cachedObject objectstorage.CachedObject) bool {
defer cachedObject.Release() cachedObject.Consume(func(object objectstorage.StorableObject) {
cachedMessageMetadata := &CachedMessageMetadata{CachedObject: cachedObject} msgMetaData := object.(*MessageMetadata)
msgMetaData := cachedMessageMetadata.Unwrap() messageCount++
messageCount++ received := msgMetaData.ReceivedTime()
received := msgMetaData.ReceivedTime() if msgMetaData.IsSolid() {
if msgMetaData.IsSolid() { solidCount++
solidCount++ sumSolidificationTime += msgMetaData.solidificationTime.Sub(received)
sumSolidificationTime += msgMetaData.solidificationTime.Sub(received) }
} })
return true return true
}) })
avgSolidificationTime = float64(sumSolidificationTime.Milliseconds()) / float64(solidCount) avgSolidificationTime = float64(sumSolidificationTime.Milliseconds()) / float64(solidCount)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment