[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
parent 1312695c46
commit d56a8d095e
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("[]")