mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
♻️ 改进后台任务判断重复
This commit is contained in:
parent
83afeb5a8b
commit
23df378a32
2 changed files with 8 additions and 4 deletions
|
|
@ -157,7 +157,7 @@ func loadTreeByBlockID(id string) (ret *parse.Tree, err error) {
|
||||||
|
|
||||||
bt := treenode.GetBlockTree(id)
|
bt := treenode.GetBlockTree(id)
|
||||||
if nil == bt {
|
if nil == bt {
|
||||||
if task.ContainIndexTask() {
|
if task.ContainIndexTask(task.DatabaseIndex, task.DatabaseIndexFull) {
|
||||||
err = ErrIndexing
|
err = ErrIndexing
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,13 @@ package task
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/88250/gulu"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -84,9 +85,12 @@ const (
|
||||||
ReloadUI = "task.reload.ui" // 重载 UI
|
ReloadUI = "task.reload.ui" // 重载 UI
|
||||||
)
|
)
|
||||||
|
|
||||||
func ContainIndexTask() bool {
|
func ContainIndexTask(action string, moreActions ...string) bool {
|
||||||
|
actions := append(moreActions, action)
|
||||||
|
actions = gulu.Str.RemoveDuplicatedElem(actions)
|
||||||
|
|
||||||
for _, task := range taskQueue {
|
for _, task := range taskQueue {
|
||||||
if DatabaseIndex == task.Action || DatabaseIndexFull == task.Action {
|
if gulu.Str.Contains(task.Action, actions) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue