-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add a caching layer to .well-known responses #4516
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4516 +/- ##
===========================================
- Coverage 74.75% 74.73% -0.03%
===========================================
Files 336 337 +1
Lines 34219 34416 +197
Branches 5570 5608 +38
===========================================
+ Hits 25580 25720 +140
- Misses 7060 7108 +48
- Partials 1579 1588 +9 |
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.
Looks broadly sane. Shame that we end up with yet another cache implementation
cache_period = WELL_KNOWN_DEFAULT_CACHE_PERIOD | ||
else: | ||
cache_period = min(cache_period, WELL_KNOWN_MAX_CACHE_PERIOD) | ||
|
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.
Don't we also want a min cache period here here?
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.
Not sure, tbh. What would you set it to? If someone says "don't cache", I'm minded to respect 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.
Oh, I hallucinated you adding a MIN
constant. I don't have strong feelings either way, though I wouldn't be surprised if people used max_age=0
, but we can revisit it later if it proves a problem
else: | ||
k, v = directive, None | ||
k = k.lower() | ||
cache_controls[k] = v |
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.
I think this needs some white space stripping? It'd be nice to have some tests that have multiple values.
Some random examples from the internet:
Cache-Control: private; max-age=0
(hacker news, looks bogus with the semi colon?)Cache-Control: max-age=0, private, must-revalidate
(github.com)cache-control: private, max-age=0
(google.com)
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.
thanks. fixed.
otherwise we get a stampede every hour.
[CI failed due to flake8 update] |
No description provided.