mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 02:28:21 +02:00
🎉 Add optional rate limit support for RPC calls
This commit is contained in:
parent
47b745592b
commit
ec3651d85b
37 changed files with 1003 additions and 333 deletions
|
@ -10,6 +10,7 @@
|
|||
[app.common.exceptions :as ex]
|
||||
[app.common.logging :as l]
|
||||
[app.common.spec :as us]
|
||||
[app.http :as-alias http]
|
||||
[clojure.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[yetti.request :as yrq]
|
||||
|
@ -50,6 +51,11 @@
|
|||
[err _]
|
||||
(yrs/response 400 (ex-data err)))
|
||||
|
||||
(defmethod handle-exception :rate-limit
|
||||
[err _]
|
||||
(let [headers (-> err ex-data ::http/headers)]
|
||||
(yrs/response :status 429 :body "" :headers headers)))
|
||||
|
||||
(defmethod handle-exception :validation
|
||||
[err _]
|
||||
(let [{:keys [code] :as data} (ex-data err)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue