🎨 改进 ocr 后台任务

This commit is contained in:
Liang Ding 2023-01-27 15:30:14 +08:00
parent c789f59b67
commit 98230a6f90
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -32,7 +32,7 @@ func autoOCRAssets() {
assetsPath := util.GetDataAssetsAbsPath()
assets := getUnOCRAssetsAbsPaths()
if 0 < len(assets) {
poolSize := runtime.NumCPU()
if 4 < poolSize {
poolSize = 4
@ -50,6 +50,7 @@ func autoOCRAssets() {
util.AssetsTextsLock.Unlock()
util.AssetsTextsChanged = true
})
for i, assetAbsPath := range assets {
waitGroup.Add(1)
p.Invoke(assetAbsPath)
@ -58,8 +59,10 @@ func autoOCRAssets() {
break
}
}
waitGroup.Wait()
p.Release()
}
cleanNotExistAssetsTexts()
}