🎨 改进块树索引

This commit is contained in:
Liang Ding 2023-02-04 10:33:20 +08:00
parent 57a3188f4c
commit 8c6b10a02b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -305,9 +305,13 @@ func updateBtSlice(n *ast.Node, tree *parse.Tree) {
slice.m.Unlock()
}
func InitBlockTree(force bool) {
start := time.Now()
var blockTreeLock = sync.Mutex{}
func InitBlockTree(force bool) {
blockTreeLock.Lock()
defer blockTreeLock.Unlock()
start := time.Now()
if force {
err := os.RemoveAll(util.BlockTreePath)
if nil != err {
@ -387,6 +391,9 @@ func SaveBlockTreeJob() {
}
func SaveBlockTree(force bool) {
blockTreeLock.Lock()
defer blockTreeLock.Unlock()
start := time.Now()
os.MkdirAll(util.BlockTreePath, 0755)