🎨 改进内核任务调度机制提升稳定性 https://github.com/siyuan-note/siyuan/issues/7113

This commit is contained in:
Liang Ding 2023-01-25 22:08:21 +08:00
parent e782e034cc
commit 07abcd0121
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
9 changed files with 15 additions and 18 deletions

View file

@ -393,7 +393,7 @@ func getBlock(id string) (ret *Block, err error) {
tree, err := loadTreeByBlockID(id)
if nil != err {
if indexing {
if isIndexing() {
err = ErrIndexing
}
return

View file

@ -54,10 +54,12 @@ func (box *Box) Index() {
var indexing = false
func waitForIndexing() {
for indexing {
func isIndexing() (ret bool) {
for i := 0; indexing || i > 7; i++ {
time.Sleep(time.Millisecond * 100)
ret = true
}
return
}
func index(boxID string) {