🎨 后台任务显示当前正在执行的任务
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}
|
||||
items = append(items, item)
|
||||
}
|
||||
|
||||
if "" != currentTaskAction {
|
||||
items = append([]map[string]interface{}{map[string]interface{}{"action": currentTaskAction}}, items...)
|
||||
}
|
||||
|
||||
if 1 > len(items) {
|
||||
items = []map[string]interface{}{}
|
||||
}
|
||||
|
@ -141,6 +146,8 @@ func ExecTaskJob() {
|
|||
execTask(task)
|
||||
}
|
||||
|
||||
var currentTaskAction string
|
||||
|
||||
func popTask() (ret *Task) {
|
||||
queueLock.Lock()
|
||||
defer queueLock.Unlock()
|
||||
|
@ -166,6 +173,8 @@ func execTask(task *Task) {
|
|||
}
|
||||
}
|
||||
|
||||
currentTaskAction = task.Action
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
|
||||
defer cancel()
|
||||
ch := make(chan bool, 1)
|
||||
|
|
Loading…
Add table
Reference in a new issue