Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 改进同步后台任务

Liang Ding8d64ae614983
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index 20baf72c07..df55363416 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -97,21 +97,23 @@ func StatusJob() {
tasks := taskQueue
data := map[string]interface{}{}
var items []map[string]interface{}
+ count := map[string]int{}
for _, task := range tasks {
- if OCRImage == task.Action || DatabaseIndexEmbedBlock == task.Action {
+ actionLangs := util.TaskActionLangs[util.Lang]
+ action := task.Action
+ if c := count[action]; 3 < c {
+ logging.LogWarnf("too many tasks [%s], ignore show its status", action)
continue
}
+ count[action]++
- actionLangs := util.TaskActionLangs[util.Lang]
- action := task.Action
if nil != actionLangs {
if label := actionLangs[task.Action]; nil != label {
action = label.(string)
}
}
- item := map[string]interface{}{
- "action": action,
- }
+
+ item := map[string]interface{}{"action": action}
items = append(items, item)
}
if 1 > len(items) {