mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 改进 ocr 后台任务
This commit is contained in:
parent
c789f59b67
commit
98230a6f90
1 changed files with 29 additions and 26 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue