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

pip_audit, test: generalize caching middleware #188

Merged
merged 4 commits into from
Dec 6, 2021
Merged

Conversation

woodruffw
Copy link
Member

This makes our OSV adaptor use the same caching middleware as our PyPI adaptor. Notably it does not currently improve performance, since OSV doesn't appear to be sending ETags or other caching headers with its response:

content-type: application/json
grpc-accept-encoding: identity,deflate,gzip
accept-encoding: identity,gzip
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
grpc-status: 0
grpc-message:
x-envoy-decorator-operation: ingress QueryAffected
x-cloud-trace-context: 0fce3535ef964b43794e46a0431db0f1
date: Mon, 06 Dec 2021 16:18:56 GMT
server: Google Frontend
content-length: 1197

That being said, I think we should still merge it -- it'll be handy for #187 as well, and it will improve our performance on OSV if/when ETags are added.

Closes #179.

@woodruffw woodruffw added enhancement New feature or request performance Something isn't as fast or responsive as it should be. labels Dec 6, 2021
@woodruffw woodruffw self-assigned this Dec 6, 2021
@di
Copy link
Member

di commented Dec 6, 2021

Notably it does not currently improve performance, since OSV doesn't appear to be sending ETags or other caching headers with its response

Given that the OSV API uses POST requests, we might never get ETags there. I created google/osv.dev#274 to determine what the right way to cache OSV should be. In the meantime, we should move forward with this regardless.

pip_audit/_cli.py Show resolved Hide resolved
@woodruffw woodruffw merged commit a4620f7 into main Dec 6, 2021
@woodruffw woodruffw deleted the ww/osv-http-caching branch December 6, 2021 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance Something isn't as fast or responsive as it should be.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perform HTTP caching for OSV
2 participants