This commit is contained in:
Daniel 2024-06-20 22:53:27 +08:00
parent 32413fa11c
commit 7a3d4a05ad
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
22 changed files with 453 additions and 497 deletions

View file

@ -82,6 +82,7 @@ func InitDatabase(forceRebuild bool) (err error) {
}
initDBConnection()
treenode.InitBlockTree(forceRebuild)
if !forceRebuild {
// 检查数据库结构版本,如果版本不一致的话说明改过表结构,需要重建
@ -101,9 +102,6 @@ func InitDatabase(forceRebuild bool) (err error) {
err = nil
}
}
if gulu.File.IsExist(util.BlockTreePath) {
treenode.InitBlockTree(true)
}
initDBConnection()
initDBTables()
@ -1278,6 +1276,11 @@ func CloseDatabase() {
logging.LogErrorf("close history database failed: %s", err)
return
}
if err := assetContentDB.Close(); nil != err {
logging.LogErrorf("close asset content database failed: %s", err)
return
}
treenode.CloseDatabase()
logging.LogInfof("closed database")
}