diff options
| author | Jonathan Amsterdam <jba@google.com> | 2021-02-17 10:19:53 -0500 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2021-02-19 18:55:45 +0000 |
| commit | 4306f9590a97ba4db4bd7693f3bf98e86b6d9783 (patch) | |
| tree | 1fa76b56e9f4e81248a6fa1144d64bcb7d7d338a /cmd/pkgsite | |
| parent | 6369e83d704e2bec4bede88567fae200679ad432 (diff) | |
| download | go-x-pkgsite-4306f9590a97ba4db4bd7693f3bf98e86b6d9783.tar.xz | |
internal/frontend: do latest-major-version logic in main serving path
Instead of using middleware to replace information about latest major
versions in the HTML, insert them in the usual way, via templates.
This is possible because the worker invalidates the cache when a new
latest version comes in.
Delete the latest-version middleware.
Fixes golang/go#44210
Change-Id: I348a25d6b8777bad555e034d38ddb4137eb6ff18
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293009
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'cmd/pkgsite')
| -rw-r--r-- | cmd/pkgsite/main.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/cmd/pkgsite/main.go b/cmd/pkgsite/main.go index b3770ff4..1d4cdcc3 100644 --- a/cmd/pkgsite/main.go +++ b/cmd/pkgsite/main.go @@ -71,10 +71,7 @@ func main() { router := dcensus.NewRouter(frontend.TagRoute) server.Install(router.Handle, nil, nil) - mw := middleware.Chain( - middleware.LatestVersions(server.GetLatestInfo), // must come before caching for version badge to work - middleware.Timeout(54*time.Second), - ) + mw := middleware.Timeout(54 * time.Second) log.Infof(ctx, "Listening on addr %s", *httpAddr) log.Fatal(ctx, http.ListenAndServe(*httpAddr, mw(router))) } |
