🎨 每次 OCR 任务最多处理 64 张图片以防止卡顿

This commit is contained in:
Liang Ding 2023-01-18 23:42:26 +08:00
parent 0da0fb6712
commit 2476776c83
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -53,17 +53,21 @@ func autoOCRAssets() {
util.AssetsTextsLock.Unlock()
util.AssetsTextsChanged = true
})
for _, assetAbsPath := range assets {
for i, assetAbsPath := range assets {
waitGroup.Add(1)
p.Invoke(assetAbsPath)
if 63 <= i { // 一次最多处理 64 张图片,防止卡顿
break
}
}
waitGroup.Wait()
p.Release()
cleanNotFoundAssetsTexts()
cleanNotExistAssetsTexts()
}
func cleanNotFoundAssetsTexts() {
func cleanNotExistAssetsTexts() {
tmp := util.AssetsTexts
assetsPath := util.GetDataAssetsAbsPath()