mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
🎨 潜在的并发冲突
This commit is contained in:
parent
3e52adf25f
commit
addadedcb8
1 changed files with 3 additions and 4 deletions
|
|
@ -49,11 +49,12 @@ func autoOCRAssets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanNotExistAssetsTexts() {
|
func cleanNotExistAssetsTexts() {
|
||||||
tmp := util.AssetsTexts
|
util.AssetsTextsLock.Lock()
|
||||||
|
defer util.AssetsTextsLock.Unlock()
|
||||||
|
|
||||||
assetsPath := util.GetDataAssetsAbsPath()
|
assetsPath := util.GetDataAssetsAbsPath()
|
||||||
var toRemoves []string
|
var toRemoves []string
|
||||||
for asset, _ := range tmp {
|
for asset, _ := range util.AssetsTexts {
|
||||||
assetAbsPath := strings.TrimPrefix(asset, "assets")
|
assetAbsPath := strings.TrimPrefix(asset, "assets")
|
||||||
assetAbsPath = filepath.Join(assetsPath, assetAbsPath)
|
assetAbsPath = filepath.Join(assetsPath, assetAbsPath)
|
||||||
if !gulu.File.IsExist(assetAbsPath) {
|
if !gulu.File.IsExist(assetAbsPath) {
|
||||||
|
|
@ -61,12 +62,10 @@ func cleanNotExistAssetsTexts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
util.AssetsTextsLock.Lock()
|
|
||||||
for _, asset := range toRemoves {
|
for _, asset := range toRemoves {
|
||||||
delete(util.AssetsTexts, asset)
|
delete(util.AssetsTexts, asset)
|
||||||
util.AssetsTextsChanged = true
|
util.AssetsTextsChanged = true
|
||||||
}
|
}
|
||||||
util.AssetsTextsLock.Unlock()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue