🎨 boot log

This commit is contained in:
Liang Ding 2022-08-31 10:50:17 +08:00
parent 5139e51165
commit 1ea657430a
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
2 changed files with 4 additions and 8 deletions

View File

@ -491,8 +491,7 @@ func (conf *AppConf) Language(num int) (ret string) {
func InitBoxes() { func InitBoxes() {
initialized := false initialized := false
blockCount := 0 if 1 > treenode.CountBlocks() {
if 1 > len(treenode.GetBlockTrees()) {
if gulu.File.IsExist(util.BlockTreePath) { if gulu.File.IsExist(util.BlockTreePath) {
util.IncBootProgress(20, "Reading block trees...") util.IncBootProgress(20, "Reading block trees...")
go func() { go func() {
@ -523,14 +522,11 @@ func InitBoxes() {
treenode.SaveBlockTree() treenode.SaveBlockTree()
} }
blocktrees := treenode.GetBlockTrees()
blockCount = len(blocktrees)
var dbSize string var dbSize string
if dbFile, err := os.Stat(util.DBPath); nil == err { if dbFile, err := os.Stat(util.DBPath); nil == err {
dbSize = humanize.Bytes(uint64(dbFile.Size())) 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 { func IsSubscriber() bool {

View File

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