New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/pkgsite: remove HTML replacements #44210
Comments
Change https://golang.org/cl/290969 mentions this issue: |
We should also explore doing cache invalidation from the worker. |
Based on recent request patterns, most cache hits (94%) happen within 10 minutes. Lower all cache TTLs to 10 minutes to validate that the cache hit ratio doesn't change significantly. For golang/go#44210 Change-Id: Ia59b7059a04215e4fe4424a4a868bc561d490b86 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290969 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Change https://golang.org/cl/292070 mentions this issue: |
Change https://golang.org/cl/292429 mentions this issue: |
Change https://golang.org/cl/292449 mentions this issue: |
Change https://golang.org/cl/292489 mentions this issue: |
Change https://golang.org/cl/292492 mentions this issue: |
Change https://golang.org/cl/292491 mentions this issue: |
It was unused. For golang/go#44210 Change-Id: I17250d27ab62217d8358bce29c2ea82353881e81 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292491 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Remove the $$ substitution for the latest-minor CSS class. Instead, determine the class on the normal serving path. This is possible because the worker invalidates the cache when processing a new latest version, so pages will not be stale even though they are cached. For golang/go#44210 Change-Id: Ide18e8257369810cd98f0b7d4fb41b75af961b83 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292492 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Make a separate test for cases where not finding a module results in a redirection. Also, get the cookie value more directly, instead of relying on cookie.Extract. For golang/go#44210 Change-Id: Ibf4ae07802e60ff6c70c3ec8835a653cb84b2368 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292070 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
For golang/go#44210 Change-Id: I3e6ec4bf592f0129004837630bec139036a22099 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292429 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Verify that a redirect banner is added when appropriate, and is not cached. For golang/go#44210 Change-Id: Ib9b8cd8c67502724aeb0dbc79b1d5ce6784a67a3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292449 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Handle the logic of the redirect banner in the ordinary serving path, instead of using a middleware layer. To make this work, we have to bypass the cache when the redirect cookie is set, so we don't cache the page with the banner. For golang/go#44210 Change-Id: I145f058373980ff9e5d3617529e849b25161b390 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292489 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
Change https://golang.org/cl/293009 mentions this issue: |
The pkg.go.dev frontend replaces placeholders in HTML in several circumstances:
These replacements have three problems:
safehtml
package.Suggested Fixes
For the redirect banner, we can just avoid caching it. To generalize, we can have our caching middleware respect the outgoing Cache-Control header. https://golang.org/cl/290889 is a proof of concept. We also have to avoid serving from the cache when the cookie is set.
To ensure that latest-version information is fresh, we can adjust the cache TTLs (the time that a page remains cached). Any non-zero TTL can produce a stale page, but perfection here is misleading. It already takes a few minutes from the time someone pushes a new latest version to the proxy, to the time that the frontend can display that version.
Frontend fetch speeds up the process, making a module available in under 30 seconds in most cases. But it is only triggered on a 404, which isn’t cached. So visiting the same URL that was just fetched should result in a fresh page. (Visiting the unversioned URL after fetching the versioned one would involve the cache, which isn't ideal. At present I have no good solution for that.)
Experiments show that about two-thirds of cache hits occur in the first five minutes, so changing the TTL to 5 minutes should not affect the cache hit ratio signicantly.
The text was updated successfully, but these errors were encountered: