mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Improve marketplace package loading https://github.com/siyuan-note/siyuan/issues/13950
This commit is contained in:
parent
5e88631c1b
commit
c1b70e4515
5 changed files with 53 additions and 0 deletions
|
|
@ -47,7 +47,11 @@ func Widgets() (widgets []*Widget) {
|
|||
return
|
||||
}
|
||||
bazaarIndex := getBazaarIndex()
|
||||
if 1 > len(bazaarIndex) {
|
||||
return
|
||||
}
|
||||
|
||||
requestFailed := false
|
||||
waitGroup := &sync.WaitGroup{}
|
||||
lock := &sync.Mutex{}
|
||||
p, _ := ants.NewPoolWithFunc(8, func(arg interface{}) {
|
||||
|
|
@ -63,15 +67,21 @@ func Widgets() (widgets []*Widget) {
|
|||
return
|
||||
}
|
||||
|
||||
if requestFailed {
|
||||
return
|
||||
}
|
||||
|
||||
widget := &Widget{}
|
||||
innerU := util.BazaarOSSServer + "/package/" + repoURL + "/widget.json"
|
||||
innerResp, innerErr := httpclient.NewBrowserRequest().SetSuccessResult(widget).Get(innerU)
|
||||
if nil != innerErr {
|
||||
logging.LogErrorf("get bazaar package [%s] failed: %s", repoURL, innerErr)
|
||||
requestFailed = true
|
||||
return
|
||||
}
|
||||
if 200 != innerResp.StatusCode {
|
||||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
requestFailed = true
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue