mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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()
|
assetsPath := util.GetDataAssetsAbsPath()
|
||||||
assets := getUnOCRAssetsAbsPaths()
|
assets := getUnOCRAssetsAbsPaths()
|
||||||
|
if 0 < len(assets) {
|
||||||
poolSize := runtime.NumCPU()
|
poolSize := runtime.NumCPU()
|
||||||
if 4 < poolSize {
|
if 4 < poolSize {
|
||||||
poolSize = 4
|
poolSize = 4
|
||||||
|
|
@ -50,6 +50,7 @@ func autoOCRAssets() {
|
||||||
util.AssetsTextsLock.Unlock()
|
util.AssetsTextsLock.Unlock()
|
||||||
util.AssetsTextsChanged = true
|
util.AssetsTextsChanged = true
|
||||||
})
|
})
|
||||||
|
|
||||||
for i, assetAbsPath := range assets {
|
for i, assetAbsPath := range assets {
|
||||||
waitGroup.Add(1)
|
waitGroup.Add(1)
|
||||||
p.Invoke(assetAbsPath)
|
p.Invoke(assetAbsPath)
|
||||||
|
|
@ -58,8 +59,10 @@ func autoOCRAssets() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waitGroup.Wait()
|
waitGroup.Wait()
|
||||||
p.Release()
|
p.Release()
|
||||||
|
}
|
||||||
|
|
||||||
cleanNotExistAssetsTexts()
|
cleanNotExistAssetsTexts()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue