Implements time limiters, aka timeouts, which throw exceptions if a fn takes too long to return.
Implements time limiters, aka timeouts, which throw exceptions if a fn takes too long to return. See https://resilience4j.readme.io/docs/timeout
Set this to override the R4j defaults with your own
Set this to override the R4j defaults with your own
(add-listeners tl {:keys [on-success on-error on-timeout]})
Add event handlers for TimeLimiter lifecycle events.
Config map options
:on-success
- a handler that runs after a successful call - receives a TimeLimiterOnSuccessEvent:on-error
- a handler that runs after an error - receives a TimeLimiterOnErrorEvent:on-timeout
- a handler that runs after a call times out - receives a TimeLimiterOnTimeoutEventAdd event handlers for TimeLimiter lifecycle events. Config map options - `:on-success` - a handler that runs after a successful call - receives a TimeLimiterOnSuccessEvent - `:on-error` - a handler that runs after an error - receives a TimeLimiterOnErrorEvent - `:on-timeout` - a handler that runs after a call times out - receives a TimeLimiterOnTimeoutEvent
(retrieve f)
Retrieves a time-limiter from a wrapped fn
Retrieves a time-limiter from a wrapped fn
(time-limiter-config config)
Creates a Resilience4j TimeLimiterConfig.
Config map options
:cancel-running-future?
- should .cancel()
be called on the running Future? - defaults to true:timeout-duration
- how long to wait before timing out - defaults to 1000 ms - accepts number of ms or java.time.DurationCreates a Resilience4j TimeLimiterConfig. Config map options - `:cancel-running-future?` - should `.cancel()` be called on the running Future? - defaults to true - `:timeout-duration` - how long to wait before timing out - defaults to 1000 ms - accepts number of ms or java.time.Duration
(wrap f tl)
Wraps a function in a TimeLimiter. Throws TimeoutException if it times out.
Attaches the time limiter as metadata on the wrapped fn at :truegrit/time-limiter
Wraps a function in a TimeLimiter. Throws TimeoutException if it times out. Attaches the time limiter as metadata on the wrapped fn at :truegrit/time-limiter
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close