-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 simple repository pages #6932
Cache simple repository pages #6932
Conversation
keeping everything happy is kind of annoying: I've refactored so that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same way we handled get_repository_config_for_url
caching, so I am more than fine with the approach. Ideally we'll move to functools.cache
instead of lru_cache
once we eventually, in the distant future drop 3.8 support; however I think pyupgrade
can likely be taught to make that change instead of leaving a comment.
c032dde
to
5e4e566
Compare
I removed the changelog label because this fixes a performance regression of an unreleased version (if I understand correctly). |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
At #5868, I suggested that some of the caching that was being reworked could be removed altogether, because cachecontrol was already taking care of it just fine.
But now I find myself using an Azure artifacts repository, and it is returning headers that insist that the client does not do any caching:
(pypi, by contrast, sets max-age to 10 minutes here).
So I was wrong! And now I am seeing a big performance hit in some projects where the solve involves overrides and backtracking: and therefore hitting the legacy simple API repeatedly.
However, we don't need all the mechanism of cachy and its like for this, a well-placed
@lru_cache()
seems more than sufficient.This makes me wonder whether it wouldn't be better to do similar for pypi anyway, and rip out cachecontrol altogether. But let's keep it simple for now: this is an easy fix to a performance regression.