mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
⚡ Improve marketplace loading performance Fix https://github.com/siyuan-note/siyuan/issues/10973
This commit is contained in:
parent
541483ed29
commit
da59fa2afa
7 changed files with 49 additions and 0 deletions
|
|
@ -53,6 +53,13 @@ func Widgets() (widgets []*Widget) {
|
|||
repo := arg.(*StageRepo)
|
||||
repoURL := repo.URL
|
||||
|
||||
if pkg, found := packageCache.Get(repoURL); found {
|
||||
lock.Lock()
|
||||
widgets = append(widgets, pkg.(*Widget))
|
||||
lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
widget := &Widget{}
|
||||
innerU := util.BazaarOSSServer + "/package/" + repoURL + "/widget.json"
|
||||
innerResp, innerErr := httpclient.NewBrowserRequest().SetSuccessResult(widget).Get(innerU)
|
||||
|
|
@ -93,6 +100,8 @@ func Widgets() (widgets []*Widget) {
|
|||
lock.Lock()
|
||||
widgets = append(widgets, widget)
|
||||
lock.Unlock()
|
||||
|
||||
packageCache.SetDefault(repoURL, widget)
|
||||
})
|
||||
for _, repo := range stageIndex.Repos {
|
||||
waitGroup.Add(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue