mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 后台任务显示当前正在执行的任务
This commit is contained in:
parent
b9f44309cb
commit
9a7a155ac7
1 changed files with 9 additions and 0 deletions
|
|
@ -121,6 +121,11 @@ func StatusJob() {
|
||||||
item := map[string]interface{}{"action": action}
|
item := map[string]interface{}{"action": action}
|
||||||
items = append(items, item)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "" != currentTaskAction {
|
||||||
|
items = append([]map[string]interface{}{map[string]interface{}{"action": currentTaskAction}}, items...)
|
||||||
|
}
|
||||||
|
|
||||||
if 1 > len(items) {
|
if 1 > len(items) {
|
||||||
items = []map[string]interface{}{}
|
items = []map[string]interface{}{}
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +146,8 @@ func ExecTaskJob() {
|
||||||
execTask(task)
|
execTask(task)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentTaskAction string
|
||||||
|
|
||||||
func popTask() (ret *Task) {
|
func popTask() (ret *Task) {
|
||||||
queueLock.Lock()
|
queueLock.Lock()
|
||||||
defer queueLock.Unlock()
|
defer queueLock.Unlock()
|
||||||
|
|
@ -166,6 +173,8 @@ func execTask(task *Task) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentTaskAction = task.Action
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
ch := make(chan bool, 1)
|
ch := make(chan bool, 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue