Skip to content
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

Improve caching of externally-fetched stylesheets #4293

Closed
westonruter opened this issue Feb 14, 2020 · 0 comments · Fixed by #4404
Closed

Improve caching of externally-fetched stylesheets #4293

westonruter opened this issue Feb 14, 2020 · 0 comments · Fixed by #4404
Assignees
Labels
CSS P0 High priority
Milestone

Comments

@westonruter
Copy link
Member

When AMP_Style_Sanitizer::fetch_external_stylesheet() fails to fetch an external stylesheet, it caches the a WP_Error in the transient as opposed to the stylesheet string. In both cases, the transient expires after a month. This should be more dynamic, namely:

  • Fetches that result in failures should be cached for a DAY_IN_SECONDS rather than MONTH_IN_SECONDS.
  • Fetches that are successful should actually use a transient expiration that reflects the Cache-Control response header, as long as the max-age is greater than some minimum amount (e.g. 1 day).

See also this todo:

* @todo Use Cache-Control max-age for transient.

Originally referenced in in #2449 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS P0 High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants