[mirror] Scalable static site server for Git forges (like GitHub Pages)

Fetch manifests in parallel when handling GET requests.

miyuko c39e57a8 3863f0f1

+8 -2
+8 -2
src/pages.go
··· 87 return err 88 } 89 90 sitePath = strings.TrimPrefix(r.URL.Path, "/") 91 if projectName, projectPath, found := strings.Cut(sitePath, "/"); found { 92 projectManifest, err := backend.GetManifest(r.Context(), makeWebRoot(host, projectName), ··· 96 } 97 } 98 if manifest == nil { 99 - manifest, err = backend.GetManifest(r.Context(), makeWebRoot(host, ".index"), 100 - GetManifestOptions{BypassCache: bypassCache}) 101 if manifest == nil { 102 if found, fallbackErr := HandleWildcardFallback(w, r); found { 103 return fallbackErr
··· 87 return err 88 } 89 90 + indexManifestCh := make(chan *Manifest, 1) 91 + go func() { 92 + manifest, _ := backend.GetManifest(r.Context(), makeWebRoot(host, ".index"), 93 + GetManifestOptions{BypassCache: bypassCache}) 94 + indexManifestCh <- manifest 95 + }() 96 + 97 sitePath = strings.TrimPrefix(r.URL.Path, "/") 98 if projectName, projectPath, found := strings.Cut(sitePath, "/"); found { 99 projectManifest, err := backend.GetManifest(r.Context(), makeWebRoot(host, projectName), ··· 103 } 104 } 105 if manifest == nil { 106 + manifest = <-indexManifestCh 107 if manifest == nil { 108 if found, fallbackErr := HandleWildcardFallback(w, r); found { 109 return fallbackErr