🎨 数据统计

This commit is contained in:
Liang Ding 2022-11-10 18:45:41 +08:00
parent 70490f3e16
commit 953ce38ab7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 51 additions and 12 deletions

View file

@ -52,13 +52,19 @@ type Box struct {
}
func AutoStat() {
autoStat()
for range time.Tick(10 * time.Minute) {
autoStat()
}
}
func autoStat() {
Conf.Stat.DocCount = sql.CountAllDoc()
Conf.Stat.TreeCount = treenode.CountTrees()
Conf.Stat.CTreeCount = treenode.CeilCount(Conf.Stat.TreeCount)
Conf.Stat.BlockCount = treenode.CountBlocks()
Conf.Stat.BlockCount = treenode.CeilCount(Conf.Stat.BlockCount)
Conf.Stat.DataSize, _ = util.SizeOfDirectory(util.DataDir)
Conf.Stat.CDataSize = util.CeilSize(Conf.Stat.DataSize)
Conf.Save()
}