limithandler: Wrap errors in ResourceExhausted
Currently we return codes.Unavailable
when a request has been terminated due to the concurrency limiter. However, this code is also returned when Gitaly is completely down, so all of our clients (shell, workhorse, rails) return a hard-coded message to contact site administrators to users when this code is returned.
Looking at how Google Cloud uses this code, it's treated as the equivalent of an HTTP 503. codes.ResourceExhausted
is the equivalent of a 429, which is returned when a request has been rate limited.
Let's switch the concurrency limiter to wrap its errors in ResourceExhausted
to bring our code usage in line with common practices and to save our clients from trying to parse the error message to determine if Gitaly is up.
Edited by Will Chandler (ex-GitLab)