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

  1. From workhorse/, run go test ./internal/git/ -run Archive.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Agent context
  • archiveErrorStatus in workhorse/internal/git/archive.go gets a codes.ResourceExhausted case returning 429.
  • Added a table case in archive_test.go that also checks the failure is non-cacheable.
  • No other test or doc enumerates this mapping.
  • go test ./internal/git/, gofmt and go vet pass. 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

Merge request reports

Loading
Loading