ソースを参照

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 2 年 前
コミット
275d96b9d2
2 ファイル変更4 行追加8 行削除
  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 {