(default-ex n ed v)The default ::exception fn. Always returns an ExceptionInfo with fusebox ex-data and the last exception as the cause.
The default ::exception fn. Always returns an ExceptionInfo with fusebox ex-data and the last exception as the cause.
(delay-exp retry-count)(delay-exp base retry-count)Calculate an exponential delay in millis.
base - the base number to scale (default 100) retry-count - the number of previous attempts
Calculate an exponential delay in millis. base - the base number to scale (default 100) retry-count - the number of previous attempts
(delay-linear factor retry-count)Calculate a linear delay in millis.
factor - the linear factor to use retry-count - the number of previous attempts
Calculate a linear delay in millis. factor - the linear factor to use retry-count - the number of previous attempts
(init {_r? :com.potetm.fusebox.retry/retry?
_d :com.potetm.fusebox.retry/delay
:as spec})Initialize a retry.
spec is map containing:
::retry? - A predicate called after an exception to determine
whether body should be retried. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.
::delay - A function which calculates the delay in millis to
wait prior to the next evaluation. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.
::success? - (Optional) A function which takes a return value and determines
whether it was successful. If false, body is retried. The last
failing value can be found under the ::retry/val key in the
thrown ex-info's data. Defaults to (constantly true).
::exception - (Optional) A function which returns the exception to throw once
::retry? returns false. Defaults to an ExceptionInfo with fusebox
ex-data and the last exception as the cause. See also
wrap-ex-after-retry andno-wrap-ex. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.
Initialize a retry.
spec is map containing:
::retry? - A predicate called after an exception to determine
whether body should be retried. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.
::delay - A function which calculates the delay in millis to
wait prior to the next evaluation. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.
::success? - (Optional) A function which takes a return value and determines
whether it was successful. If false, body is retried. The last
failing value can be found under the `::retry/val` key in the
thrown ex-info's data. Defaults to (constantly true).
::exception - (Optional) A function which returns the exception to throw once
::retry? returns false. Defaults to an ExceptionInfo with fusebox
ex-data and the last exception as the cause. See also
`wrap-ex-after-retry and `no-wrap-ex. Takes three args:
eval-count, exec-duration-ms, and the exception/failing value.(jitter jitter-factor delay)Randomly jitter a given delay.
jitter-factor - the decimal jitter percentage, between 0 and 1 delay - the base delay in millis
Randomly jitter a given delay. jitter-factor - the decimal jitter percentage, between 0 and 1 delay - the base delay in millis
(no-wrap-ex n ed v)An ::exception fn. Only wraps with an if the failing value was not an Exception (i.e. ::success? returned false).
An ::exception fn. Only wraps with an if the failing value was not an Exception (i.e. ::success? returned false).
(retry* spec f)DEPRECATED: This was an early mistake. It should have been named with-retry*.
DEPRECATED: This was an early mistake. It should have been named with-retry*.
(with-retry bindings|spec & [spec|body & body :as b])Evaluates body, retrying according to the provided retry spec.
Evaluates body, retrying according to the provided retry spec.
(with-retry* {succ? :com.potetm.fusebox.retry/success?
retry? :com.potetm.fusebox.retry/retry?
delay :com.potetm.fusebox.retry/delay
exception :com.potetm.fusebox.retry/exception
:or {succ? always-success exception default-ex}}
f)(wrap-ex-after-retry n ed v)An ::exception fn. Only wraps with an ExceptionInfo if a retry was attempted or if the failing value was not an Exception (i.e. ::success? returned false).
An ::exception fn. Only wraps with an ExceptionInfo if a retry was attempted or if the failing value was not an Exception (i.e. ::success? returned false).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |