|
@@ -53,6 +53,13 @@ func Templates() (templates []*Template) {
|
|
repo := arg.(*StageRepo)
|
|
repo := arg.(*StageRepo)
|
|
repoURL := repo.URL
|
|
repoURL := repo.URL
|
|
|
|
|
|
|
|
+ if pkg, found := packageCache.Get(repoURL); found {
|
|
|
|
+ lock.Lock()
|
|
|
|
+ templates = append(templates, pkg.(*Template))
|
|
|
|
+ lock.Unlock()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
template := &Template{}
|
|
template := &Template{}
|
|
innerU := util.BazaarOSSServer + "/package/" + repoURL + "/template.json"
|
|
innerU := util.BazaarOSSServer + "/package/" + repoURL + "/template.json"
|
|
innerResp, innerErr := httpclient.NewBrowserRequest().SetSuccessResult(template).Get(innerU)
|
|
innerResp, innerErr := httpclient.NewBrowserRequest().SetSuccessResult(template).Get(innerU)
|
|
@@ -93,6 +100,8 @@ func Templates() (templates []*Template) {
|
|
lock.Lock()
|
|
lock.Lock()
|
|
templates = append(templates, template)
|
|
templates = append(templates, template)
|
|
lock.Unlock()
|
|
lock.Unlock()
|
|
|
|
+
|
|
|
|
+ packageCache.SetDefault(repoURL, template)
|
|
})
|
|
})
|
|
for _, repo := range stageIndex.Repos {
|
|
for _, repo := range stageIndex.Repos {
|
|
waitGroup.Add(1)
|
|
waitGroup.Add(1)
|