(init {n :com.potetm.fusebox.rate-limit/bucket-size
p :com.potetm.fusebox.rate-limit/period-ms
_to :com.potetm.fusebox.rate-limit/wait-timeout-ms
:as spec})
Initialize a token bucket rate limiter.
spec is a map containing: ::bucket-size - the integer number of tokens per period ::period-ms - millis in each period ::wait-timeout-ms - max millis a thread waits for a token
Note: A leaky bucket rate limiter can be easily achieved by setting ::bucket-size to 1 and adjusting ::period-ms accordingly.
Initialize a token bucket rate limiter. spec is a map containing: ::bucket-size - the integer number of tokens per period ::period-ms - millis in each period ::wait-timeout-ms - max millis a thread waits for a token Note: A leaky bucket rate limiter can be easily achieved by setting ::bucket-size to 1 and adjusting ::period-ms accordingly.
(rate-limit* {s :com.potetm.fusebox.rate-limit/sem
to :com.potetm.fusebox.rate-limit/wait-timeout-ms
:as spec}
f)
(shutdown {sf :com.potetm.fusebox.rate-limit/sched-fut
s :com.potetm.fusebox.rate-limit/sem})
(with-rate-limit spec & body)
Evaluates body, guarded by the provided rate limiter.
Evaluates body, guarded by the provided rate limiter.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close