[performance] simpler throttling logic (#2407)

* reduce complexity of throttling logic to use 1 queue and an atomic int

* use atomic add instead of CAS, add throttling test
This commit is contained in:
kim 2023-12-16 11:53:42 +00:00 committed by GitHub
commit d56a8d095e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 208 additions and 40 deletions

View file

@ -42,6 +42,12 @@ var (
StatusInternalServerErrorJSON = mustJSON(map[string]string{
"status": http.StatusText(http.StatusInternalServerError),
})
ErrorCapacityExceeded = mustJSON(map[string]string{
"error": "server capacity exceeded!",
})
ErrorRateLimitReached = mustJSON(map[string]string{
"error": "rate limit reached!",
})
EmptyJSONObject = mustJSON("{}")
EmptyJSONArray = mustJSON("[]")