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

cache-control: private is playing havoc with performance #47

Closed
simonw opened this issue Oct 7, 2019 · 2 comments
Closed

cache-control: private is playing havoc with performance #47

simonw opened this issue Oct 7, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Oct 7, 2019

In #6 we disabled all caching for logged in users.

# Rebuild headers to include cache-control: private
original_headers = event.get("headers") or []
new_headers = [
[key, value]
for key, value in original_headers
if key.lower() != b"cache-control"
]
new_headers.append([b"cache-control", b"private"])

It turns out this is causing really nasty performance issues when running with other plugins such as datasette-vega! See simonw/datasette#586

@simonw
Copy link
Owner Author

simonw commented Oct 7, 2019

github__repos__32_rows_where_where_private___1

@simonw
Copy link
Owner Author

simonw commented Oct 7, 2019

I'm going to fix this by having the code NOT apply cache-control: private to anything within the /-/static directory - but only when the ASGI middleware is being used by Datasette.

This means I'll add an opt-out mechanism that other users of the middleware can potentially tap into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant