Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uv-client: make the cache heal itself
This change detects payload deserialization errors, emits a (non-user) warning and sends a fresh request to get new data. This self-healing existed before some of my zero-copy deserialization work landed, but my changes ended up losing half of it. The half that still remains is if the cache policy itself fails to deserialize (since it is done separately from the payload). This commit now also does it if the payload fails to deserialize. Unfortunately, we do clone the request here pessimistically in case we need to resend it. Indeed, we might end up sending two requests: a re-validation request and then another fresh request if we discover our cached data is bad after the revalidation request. We could try to deserialize the cached data before (possibly) sending the initial request. But this does extra work (checking the validity of the cached copy) even if we don't use it. It's hard to know exactly which approach would be faster, but I went this route because the request is typically very small.
- Loading branch information