Kaynağa Gözat

:art: boot log

Liang Ding 2 yıl önce
ebeveyn
işleme
1ea657430a
2 değiştirilmiş dosya ile 4 ekleme ve 8 silme
  1. 2 6
      kernel/model/conf.go
  2. 2 2
      kernel/treenode/blocktree.go

+ 2 - 6
kernel/model/conf.go

@@ -491,8 +491,7 @@ func (conf *AppConf) Language(num int) (ret string) {
 
 func InitBoxes() {
 	initialized := false
-	blockCount := 0
-	if 1 > len(treenode.GetBlockTrees()) {
+	if 1 > treenode.CountBlocks() {
 		if gulu.File.IsExist(util.BlockTreePath) {
 			util.IncBootProgress(20, "Reading block trees...")
 			go func() {
@@ -523,14 +522,11 @@ func InitBoxes() {
 		treenode.SaveBlockTree()
 	}
 
-	blocktrees := treenode.GetBlockTrees()
-	blockCount = len(blocktrees)
-
 	var dbSize string
 	if dbFile, err := os.Stat(util.DBPath); nil == err {
 		dbSize = humanize.Bytes(uint64(dbFile.Size()))
 	}
-	logging.LogInfof("database size [%s], block count [%d]", dbSize, blockCount)
+	logging.LogInfof("database size [%s], tree/block count [%d/%d]", dbSize, treenode.CountTrees(), treenode.CountBlocks())
 }
 
 func IsSubscriber() bool {

+ 2 - 2
kernel/treenode/blocktree.go

@@ -56,8 +56,8 @@ func CountTrees() (ret int) {
 	return
 }
 
-func GetBlockTrees() map[string]*BlockTree {
-	return blockTrees
+func CountBlocks() (ret int) {
+	return len(blockTrees)
 }
 
 func GetBlockTreeRootByPath(boxID, path string) *BlockTree {