mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-18 13:08:06 +01:00
🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113
This commit is contained in:
parent
2e773ade52
commit
0a2d095d00
3 changed files with 60 additions and 6 deletions
|
|
@ -69,20 +69,23 @@ func autoFixIndex() {
|
|||
for _, root := range roots {
|
||||
rootMap[root.ID] = root
|
||||
}
|
||||
|
||||
var toRemoveRootIDs []string
|
||||
var deletes int
|
||||
for _, rootID := range duplicatedRootIDs {
|
||||
root := rootMap[rootID]
|
||||
if nil == root {
|
||||
continue
|
||||
}
|
||||
|
||||
//logging.LogWarnf("exist more than one tree [%s], reindex it", rootID)
|
||||
sql.RemoveTreeQueue(root.Box, rootID)
|
||||
deletes++
|
||||
toRemoveRootIDs = append(toRemoveRootIDs, rootID)
|
||||
if util.IsExiting {
|
||||
break
|
||||
}
|
||||
}
|
||||
toRemoveRootIDs = gulu.Str.RemoveDuplicatedElem(toRemoveRootIDs)
|
||||
sql.BatchRemoveTreeQueue(toRemoveRootIDs)
|
||||
|
||||
if 0 < deletes {
|
||||
logging.LogWarnf("exist more than one tree duplicated [%d], reindex it", deletes)
|
||||
}
|
||||
|
|
@ -203,17 +206,20 @@ func reindexTreeByUpdated(rootUpdatedMap, dbRootUpdatedMap map[string]string) {
|
|||
for _, block := range blocks {
|
||||
roots[block.RootID] = block
|
||||
}
|
||||
var toRemoveRootIDs []string
|
||||
for id, root := range roots {
|
||||
if nil == root {
|
||||
continue
|
||||
}
|
||||
|
||||
logging.LogWarnf("tree [%s] is not in block tree, remove it from [%s]", id, root.Box)
|
||||
sql.RemoveTreeQueue(root.Box, root.ID)
|
||||
toRemoveRootIDs = append(toRemoveRootIDs, id)
|
||||
if util.IsExiting {
|
||||
break
|
||||
}
|
||||
}
|
||||
toRemoveRootIDs = gulu.Str.RemoveDuplicatedElem(toRemoveRootIDs)
|
||||
//logging.LogWarnf("tree [%s] is not in block tree, remove it from [%s]", id, root.Box)
|
||||
sql.BatchRemoveTreeQueue(toRemoveRootIDs)
|
||||
}
|
||||
|
||||
func reindexTreeByPath(box, p string, i, size int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue