summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-12-16 11:53:42 +0000
committerLibravatar GitHub <noreply@github.com>2023-12-16 12:53:42 +0100
commitd56a8d095e8fe84422ef4098d1e1a25198da17a1 (patch)
treecb34cb50335098492c863e4630dfd0b8da10d6c5 /internal/api
parent[docs]: Update FAQ and ROADMAP (#2458) (diff)
downloadgotosocial-d56a8d095e8fe84422ef4098d1e1a25198da17a1.tar.xz
[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
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/util/response.go6
1 files changed, 6 insertions, 0 deletions
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("[]")