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

This commit is contained in:
Liang Ding 2023-01-25 11:14:15 +08:00
parent 8e6628cfa2
commit e44bf92c63
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -52,7 +52,6 @@ func PrependTask(action string, handler interface{}, args ...interface{}) {
return
}
cancelTask(action)
taskQueue = append([]*Task{newTask(action, handler, args...)}, taskQueue...)
}
@ -65,7 +64,6 @@ func AppendTask(action string, handler interface{}, args ...interface{}) {
return
}
cancelTask(action)
taskQueue = append(taskQueue, newTask(action, handler, args...))
}
@ -73,10 +71,6 @@ func CancelTask(actions ...string) {
queueLock.Lock()
defer queueLock.Unlock()
cancelTask(actions...)
}
func cancelTask(actions ...string) {
for i := len(taskQueue) - 1; i >= 0; i-- {
task := taskQueue[i]
for _, action := range actions {