cloudflare / cloudflare/pingora
Allow cancelling caching when all downstreams disconnect prematurely
- Dominant language
- Rust
- Stars
- 27.4k
- Forks
- 1.7k
- Avg merge
- 6h 22m
- Merged PRs (30d)
- 3
Description
## What is the problem your feature solves, or the need it fulfills?
When `Storage::support_streaming_partial_write` returns `true`, the proxy ignores that downstream disconnected and continues caching:
```
WARN - Downstream Error ignored during caching: ConnectionClosed context: Prematurely before response body is complete, GET ...
```
This means the response will always be cached, even if it is never requested again.
## Describe the solution you'd like
`ProxyHttp` could offer an API that would let the implementation decide whether to continue caching or cancel, e.g., based on how much of the response is already cached, the size of the response, cache occupation, etc.
## Describe alternatives you've considered
Turning off `support_streaming_partial_write`, but this blocks other requests until caching finishes and always cancels caching, even if it is almost done.
Contributor guide
Research direction
Start by reading the ProxyHttp API and Storage::support_streaming_partial_write behavior, then trace how downstream disconnects are handled during caching. Define the API decision needed to continue or cancel caching, including the response-progress factors described in the issue. Done means implementations can make that choice without disabling partial writes, with the resulting behavior verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100