From d56a8d095e8fe84422ef4098d1e1a25198da17a1 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Sat, 16 Dec 2023 11:53:42 +0000 Subject: [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 --- internal/api/util/response.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/api/util/response.go') diff --git a/internal/api/util/response.go b/internal/api/util/response.go index e22bac545..150d2ac2e 100644 --- a/internal/api/util/response.go +++ b/internal/api/util/response.go @@ -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("[]") -- cgit v1.2.3