-
Notifications
You must be signed in to change notification settings - Fork 2
fix(cache): add some minimal cache to prevent 429s #158
Conversation
fixes #153 recommended for adobe/helix-content-proxy#144
Codecov Report
@@ Coverage Diff @@
## master #158 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 11 11
Lines 292 292
=========================================
Hits 292 292
Continue to review full report at Codecov.
|
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.
see reasoning in adobe/helix-content-proxy#144 (review)
Reverse logic: if request cache-control header is set to max-age=xx
overwrite the response cache-control header.
sidenote: 120s is way too long.... in order to prevent rate-limit problems, 10s is enough.
I can add replaying the request cache control ( Sidenote: the cache is per URL, 120 seconds is Excel's back-off time and I'd consider 60 seconds the minimum for a short-lived cache. |
note, that but still - I think default should be
maybe the back-off time, but when we cache every 10 seconds, and have 1000 hits/seconds, we still only get 1 every 10 seconds (well, if the cache serves stale-while-invalidate). so this is enough to throttle. 1 minute is a long time to way for your page to get updated...... |
We do have an easy and standardized way of disabling caching on request: We do not have a way of enabling it on demand. Sure, we could try to build a kludge, but it would be ad-hoc and brittle. The vast majority of requests we serve are old content served to visitors. If we have a way of satisfying these requests in a fast and scalable way (without hitting rate limits) then this should be the default. The exceptional case that an author wants an immediate preview is something that we can handle through a special case ( Remember that we have four consumers of
And even for For this use case, I'd recommend that we improve |
I think @davidnuescheler would disagree.... anyways.... I still think that no cache should be the default. or at least, set the max-age to 10 seconds. |
This PR will trigger a patch release when merged. |
fixes #153
recommended for adobe/helix-content-proxy#144