♻️ 后台任务队列支持设置超时 Fix https://github.com/siyuan-note/siyuan/issues/7331

This commit is contained in:
Liang Ding 2023-02-11 09:56:39 +08:00
parent a6d945a9a1
commit 5e254500ef
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 15 additions and 13 deletions

View file

@ -21,7 +21,7 @@ func OCRAssetsJob() {
return
}
task.AppendTask(task.OCRImage, autoOCRAssets)
task.AppendTaskWithTimeout(task.OCRImage, 7*time.Second, autoOCRAssets)
}
func autoOCRAssets() {
@ -39,7 +39,7 @@ func autoOCRAssets() {
util.AssetsTextsLock.Unlock()
util.AssetsTextsChanged = true
if 16 <= i { // 一次任务中最多处理 16 张图片,防止卡顿
if 4 <= i { // 一次任务中最多处理 4 张图片,防止卡顿
break
}
}