From addadedcb8fe061554a398d7ae3c3b0f68a29b84 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 26 Feb 2023 10:17:28 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=BD=9C=E5=9C=A8=E7=9A=84=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/ocr.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/model/ocr.go b/kernel/model/ocr.go index f6944965e..89beec505 100644 --- a/kernel/model/ocr.go +++ b/kernel/model/ocr.go @@ -49,11 +49,12 @@ func autoOCRAssets() { } func cleanNotExistAssetsTexts() { - tmp := util.AssetsTexts + util.AssetsTextsLock.Lock() + defer util.AssetsTextsLock.Unlock() assetsPath := util.GetDataAssetsAbsPath() var toRemoves []string - for asset, _ := range tmp { + for asset, _ := range util.AssetsTexts { assetAbsPath := strings.TrimPrefix(asset, "assets") assetAbsPath = filepath.Join(assetsPath, assetAbsPath) if !gulu.File.IsExist(assetAbsPath) { @@ -61,12 +62,10 @@ func cleanNotExistAssetsTexts() { } } - util.AssetsTextsLock.Lock() for _, asset := range toRemoves { delete(util.AssetsTexts, asset) util.AssetsTextsChanged = true } - util.AssetsTextsLock.Unlock() return }