mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 08:00:13 +01:00
🎨 异步刷新资源文件缓存
This commit is contained in:
parent
143bf0f65a
commit
056f1ed579
3 changed files with 4 additions and 2 deletions
2
kernel/cache/asset.go
vendored
2
kernel/cache/asset.go
vendored
|
|
@ -37,6 +37,8 @@ var Assets = map[string]*Asset{}
|
||||||
var assetsLock = sync.Mutex{}
|
var assetsLock = sync.Mutex{}
|
||||||
|
|
||||||
func LoadAssets() {
|
func LoadAssets() {
|
||||||
|
defer logging.Recover()
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
assetsLock.Lock()
|
assetsLock.Lock()
|
||||||
defer assetsLock.Unlock()
|
defer assetsLock.Unlock()
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ func watchAssets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新缓存资源文件,以便使用 /资源 搜索
|
// 重新缓存资源文件,以便使用 /资源 搜索
|
||||||
cache.LoadAssets()
|
go cache.LoadAssets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func watchAssets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新缓存资源文件,以便使用 /资源 搜索
|
// 重新缓存资源文件,以便使用 /资源 搜索
|
||||||
cache.LoadAssets()
|
go cache.LoadAssets()
|
||||||
case err, ok := <-assetsWatcher.Error:
|
case err, ok := <-assetsWatcher.Error:
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue