Loading
Workhorse: return 429 when Gitaly rejects GetArchive with ResourceExhausted
What does this MR do and why?
When Gitaly's concurrency limiter rejects an archive request, Workhorse now answers 429 Too Many Requests instead of 500. Clients can then tell overload from a real server error and back off. Gitaly's limiter attaches a LimitError with retry_after = 0, so there's no usable delay and no Retry-After header is set. Rails maps the same error to 503, but I went with 429 as the issue asks, and Workhorse queueing and the archive rate limit already use 429. These responses also drop out of the Workhorse 5xx SLIs.
References
Closes #633785 (closed)
Screenshots or screen recordings
N/A, no UI change.
How to set up and validate locally
- From
workhorse/, rungo test ./internal/git/ -run Archive.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
Agent context
archiveErrorStatusinworkhorse/internal/git/archive.gogets acodes.ResourceExhaustedcase returning 429.- Added a table case in
archive_test.gothat also checks the failure is non-cacheable. - No other test or doc enumerates this mapping.
go test ./internal/git/, gofmt andgo vetpass. golangci-lint wasn't runnable locally.- Pushed with hooks off because the pre-push danger hook can't load Ruby gems in this worktree.
Edited by Dmitry Gruzd