mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-12-02 19:40:35 +08:00
httpd: Limit concurrent diffs
The limits on commit and diff responses bound each request, but not how many run at once. Each request runs on its own blocking thread and keeps running after its client disconnects, so a client sending many requests for large diffs in parallel can still exhaust httpd's memory. At most 4 commit, diff and diff stats requests now compute diffs at the same time. Others wait for up to 10 seconds, which takes no memory beyond the request, and then fail with 503 and `Retry-After`. Waiting instead of failing at once keeps pages that request many commits at once, such as repo listings in deployed explorers, working.
This commit is contained in:
@@ -46,6 +46,9 @@ Explorer supports httpd 0.28.0 and newer, set by `minimumSupportedVersion` in
|
||||
files as binary.
|
||||
- Changed in place: `git diff --numstat`, also behind `/diff/:base/:oid/stats`,
|
||||
counts files over 1 MiB as binary, with no lines.
|
||||
- Changed in place: the commit, diff and diff stats endpoints return 503 with
|
||||
`Retry-After` when no diff slot frees up within 10 seconds. Older clients show
|
||||
it as a failed request.
|
||||
- Read by: client.
|
||||
|
||||
## 0.31.0
|
||||
|
||||
Reference in New Issue
Block a user