(check {:keys [attempts exception-field-key] :as throttler} keyy)
Throttle an API call based on values of KEYY. Each call to this function will record KEYY to THROTTLER's internal list; if the number of entires containing KEYY exceed THROTTLER's thresholds, throw an exception.
(defendpoint POST [:as {{:keys [email]} :body}] (throttle/check email-throttler email) ...)
Throttle an API call based on values of KEYY. Each call to this function will record KEYY to THROTTLER's internal list; if the number of entires containing KEYY exceed THROTTLER's thresholds, throw an exception. (defendpoint POST [:as {{:keys [email]} :body}] (throttle/check email-throttler email) ...)
(make-throttler exception-field-key & {:as kwargs})
Create a new Throttler
.
(require '[metabase.api.common.throttle :as throttle]) (def email-throttler (throttle/make-throttler :email, :attempts-threshold 10))
Create a new `Throttler`. (require '[metabase.api.common.throttle :as throttle]) (def email-throttler (throttle/make-throttler :email, :attempts-threshold 10))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close