mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve kernel stability by eliminating some data races https://github.com/siyuan-note/siyuan/issues/9842
This commit is contained in:
parent
dbd52231e9
commit
071f3f9af8
2 changed files with 7 additions and 7 deletions
|
|
@ -44,7 +44,7 @@ func autoOCRAssets() {
|
|||
util.AssetsTexts[p] = text
|
||||
util.AssetsTextsLock.Unlock()
|
||||
if "" != text {
|
||||
util.AssetsTextsChanged = true
|
||||
util.AssetsTextsChanged.Store(true)
|
||||
}
|
||||
if 7 <= i { // 一次任务中最多处理 7 张图片,防止长时间占用系统资源
|
||||
break
|
||||
|
|
@ -71,7 +71,7 @@ func cleanNotExistAssetsTexts() {
|
|||
|
||||
for _, asset := range toRemoves {
|
||||
delete(util.AssetsTexts, asset)
|
||||
util.AssetsTextsChanged = true
|
||||
util.AssetsTextsChanged.Store(true)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ func LoadAssetsTexts() {
|
|||
}
|
||||
|
||||
func SaveAssetsTexts() {
|
||||
if !util.AssetsTextsChanged {
|
||||
if !util.AssetsTextsChanged.Load() {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -160,5 +160,5 @@ func SaveAssetsTexts() {
|
|||
logging.LogWarnf("save assets texts [size=%s] to [%s], elapsed [%.2fs]", humanize.Bytes(uint64(len(data))), assetsTextsPath, elapsed)
|
||||
}
|
||||
|
||||
util.AssetsTextsChanged = false
|
||||
util.AssetsTextsChanged.Store(false)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue