From 2476776c83fe945fb0d128eb5267344e0862e2d0 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 18 Jan 2023 23:42:26 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=AF=8F=E6=AC=A1=20OCR=20=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=9C=80=E5=A4=9A=E5=A4=84=E7=90=86=2064=20=E5=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=BB=A5=E9=98=B2=E6=AD=A2=E5=8D=A1=E9=A1=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/ocr.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/model/ocr.go b/kernel/model/ocr.go index 740145e4d..96c493c8b 100644 --- a/kernel/model/ocr.go +++ b/kernel/model/ocr.go @@ -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()