http: dynamic responses for empty cache entries #603
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the cache entry for any given url was cleared, this would be indicated by a null entry for that url, and vere would serve a 404 for those cases, instead of falling back to the normal, dynamic behavior of injecting the request into eyre.
Here, we make eyre serve from the cache only if there is a full cache entry for the url, and have it proceed into normal request injection logic otherwise.
This way, setting a cached response for some url no longer means giving up dynamic responses on that url for the rest of time.
Recent versions of eyre exhibit the same behavior. As such, in practice, this code won't change the observed behavior without a similarly-patched version of eyre. For that, see the sister PR, urbit/urbit#6909.
The bulk of the updated logic in
_http_cache_respond()
comes from_http_rec_accept()
, but due to differences in cache checking behavior it isn't a 1:1 match, so it seemed simplest for now to just duplicate the logic, rather than introduce another intermediary request handling function.Resolves urbit/urbit#6702.