소스 검색

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 2 년 전
부모
커밋
1a405ef519
1개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 4
      kernel/model/ocr.go

+ 3 - 4
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
 }