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

Comments

@simonw
Copy link
Owner

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

This comment has been minimized.

Copy link
Owner Author

commented Oct 7, 2019

github__repos__32_rows_where_where_private___1

@simonw

This comment has been minimized.

Copy link
Owner Author

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.

simonw added a commit that referenced this issue Oct 7, 2019
@simonw simonw referenced this issue Oct 7, 2019
1 of 1 task complete
simonw added a commit that referenced this issue Oct 7, 2019
@simonw simonw closed this in e4334d7 Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.