Liking cljdoc? Tell your friends :D

net.modulolotus.truegrit.rate-limiter

Implements rate limiters, which throttle fns that are called too often.

See https://resilience4j.readme.io/docs/ratelimiter

Implements rate limiters, which throttle fns that are called too often.

See https://resilience4j.readme.io/docs/ratelimiter
raw docstring

*default-config*clj

Set this to override the R4j defaults with your own

Set this to override the R4j defaults with your own
sourceraw docstring

add-listenersclj

(add-listeners rl {:keys [on-success on-failure]})

Add event handlers for RateLimiter lifecycle events.

Config map options:

  • :on-success - a handler that runs after a successful call - receives a RateLimiterOnSuccessEvent
  • :on-failure - a handler that runs after an failure - receives a RateLimiterOnFailureEvent
Add event handlers for RateLimiter lifecycle events.

Config map options:
 - `:on-success` - a handler that runs after a successful call - receives a RateLimiterOnSuccessEvent
 - `:on-failure` - a handler that runs after an failure - receives a RateLimiterOnFailureEvent
sourceraw docstring

metricsclj

(metrics rl)

Returns metrics for the given rate limiter. Mostly useful for debugging.

Available permission count is an estimate. Can be negative if some permissions were reserved.

The number of waiting threads is also only an estimate.

Returns metrics for the given rate limiter. Mostly useful for
debugging.

Available permission count is an estimate. Can be negative if
some permissions were reserved.

The number of waiting threads is also only an estimate.
sourceraw docstring

rate-limiterclj

(rate-limiter rate-limiter-name config)

Creates a RateLimiter

Creates a RateLimiter
sourceraw docstring

rate-limiter-configclj

(rate-limiter-config config)

Creates a Resilience4j RateLimiterConfig.

Config map options

  • :limit-for-period - the number of calls allowed per time window - defaults to 50
  • :limit-refresh-period - the Duration of the time window - defaults to 500 nanoseconds - accepts number of milliseconds or java.time.Duration
  • :timeout-duration - how long to wait to be allowed to proceed before timing out - defaults to 5000 ms - accepts number of milliseconds or java.time.Duration
Creates a Resilience4j RateLimiterConfig.

Config map options
 - `:limit-for-period` - the number of calls allowed per time window - defaults to 50
 - `:limit-refresh-period` - the Duration of the time window - defaults to 500 nanoseconds - accepts number of milliseconds or java.time.Duration
 - `:timeout-duration` - how long to wait to be allowed to proceed before timing out - defaults to 5000 ms - accepts number of milliseconds or java.time.Duration
sourceraw docstring

retrieveclj

(retrieve f)

Retrieves a rate-limiter from a wrapped fn

Retrieves a rate-limiter from a wrapped fn
sourceraw docstring

wrapclj

(wrap f rl)

Wraps a fn in a RateLimiter. Throws RequestNotPermitted if permission to run was not acquired.

Attaches the rate limiter as metadata on the wrapped fn at :truegrit/rate-limiter

Wraps a fn in a RateLimiter. Throws RequestNotPermitted if permission to run was not acquired.

Attaches the rate limiter as metadata on the wrapped fn at :truegrit/rate-limiter
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close