🎨 tree not found
appears when rebuilding index https://github.com/siyuan-note/siyuan/issues/11036
This commit is contained in:
parent
1ae39777a6
commit
16c665bfa7
4 changed files with 16 additions and 12 deletions
|
@ -506,14 +506,15 @@ func FullReindex() {
|
|||
}
|
||||
|
||||
func fullReindex() {
|
||||
util.PushMsg(Conf.Language(35), 7*1000)
|
||||
util.PushEndlessProgress(Conf.language(35))
|
||||
defer util.PushClearProgress()
|
||||
|
||||
WaitForWritingFiles()
|
||||
|
||||
if err := sql.InitDatabase(true); nil != err {
|
||||
os.Exit(logging.ExitCodeReadOnlyDatabase)
|
||||
return
|
||||
}
|
||||
treenode.InitBlockTree(true)
|
||||
|
||||
sql.IndexIgnoreCached = false
|
||||
openedBoxes := Conf.GetOpenedBoxes()
|
||||
|
|
|
@ -162,7 +162,7 @@ func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) {
|
|||
|
||||
bt := treenode.GetBlockTree(id)
|
||||
if nil == bt {
|
||||
if task.Contain(task.DatabaseIndex, task.DatabaseIndexFull) {
|
||||
if task.ContainIndexTask() {
|
||||
err = ErrIndexing
|
||||
return
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ func LoadTreeByBlockID(id string) (ret *parse.Tree, err error) {
|
|||
|
||||
bt := treenode.GetBlockTree(id)
|
||||
if nil == bt {
|
||||
if task.Contain(task.DatabaseIndex, task.DatabaseIndexFull) {
|
||||
if task.ContainIndexTask() {
|
||||
err = ErrIndexing
|
||||
return
|
||||
}
|
||||
|
|
|
@ -115,17 +115,13 @@ var uniqueActions = []string{
|
|||
AssetContentDatabaseIndexCommit,
|
||||
}
|
||||
|
||||
func Contain(action string, moreActions ...string) bool {
|
||||
actions := append(moreActions, action)
|
||||
actions = gulu.Str.RemoveDuplicatedElem(actions)
|
||||
|
||||
queueLock.Lock()
|
||||
for _, task := range taskQueue {
|
||||
if gulu.Str.Contains(task.Action, actions) {
|
||||
func ContainIndexTask() bool {
|
||||
actions := getCurrentActions()
|
||||
for _, action := range actions {
|
||||
if gulu.Str.Contains(action, []string{DatabaseIndexFull, DatabaseIndex}) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
queueLock.Unlock()
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
"github.com/panjf2000/ants/v2"
|
||||
util2 "github.com/siyuan-note/dejavu/util"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/task"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"github.com/vmihailenco/msgpack/v5"
|
||||
)
|
||||
|
@ -504,6 +505,12 @@ func SaveBlockTree(force bool) {
|
|||
blockTreeLock.Lock()
|
||||
defer blockTreeLock.Unlock()
|
||||
|
||||
if task.ContainIndexTask() {
|
||||
//logging.LogInfof("skip saving block tree because indexing")
|
||||
return
|
||||
}
|
||||
//logging.LogInfof("saving block tree")
|
||||
|
||||
start := time.Now()
|
||||
if err := os.MkdirAll(util.BlockTreePath, 0755); nil != err {
|
||||
logging.LogErrorf("create block tree dir [%s] failed: %s", util.BlockTreePath, err)
|
||||
|
|
Loading…
Add table
Reference in a new issue