Fetch manifests in parallel when handling GET requests.

This commit is contained in:
miyuko
2025-10-17 17:12:24 +01:00
parent 3863f0f134
commit c39e57a857

View File

@@ -87,6 +87,13 @@ func getPage(w http.ResponseWriter, r *http.Request) error {
return err
}
indexManifestCh := make(chan *Manifest, 1)
go func() {
manifest, _ := backend.GetManifest(r.Context(), makeWebRoot(host, ".index"),
GetManifestOptions{BypassCache: bypassCache})
indexManifestCh <- manifest
}()
sitePath = strings.TrimPrefix(r.URL.Path, "/")
if projectName, projectPath, found := strings.Cut(sitePath, "/"); found {
projectManifest, err := backend.GetManifest(r.Context(), makeWebRoot(host, projectName),
@@ -96,8 +103,7 @@ func getPage(w http.ResponseWriter, r *http.Request) error {
}
}
if manifest == nil {
manifest, err = backend.GetManifest(r.Context(), makeWebRoot(host, ".index"),
GetManifestOptions{BypassCache: bypassCache})
manifest = <-indexManifestCh
if manifest == nil {
if found, fallbackErr := HandleWildcardFallback(w, r); found {
return fallbackErr