(additive-strategy increment)
(additive-strategy initial-delay increment)
Returns a retry strategy where, after the initial-delay
(ms), the
delay increases by increment
(ms) after each retry. The single
argument version uses the given increment as both the initial delay
and the increment.
Returns a retry strategy where, after the `initial-delay` (ms), the delay increases by `increment` (ms) after each retry. The single argument version uses the given increment as both the initial delay and the increment.
(clamp-delay delay retry-strategy)
Replace delays in the strategy that are larger than delay
with
delay
.
Replace delays in the strategy that are larger than `delay` with `delay`.
(constant-strategy delay)
Generates a retry strategy with a constant delay (ms) between retries, ie the delay is the same for each retry.
Generates a retry strategy with a constant delay (ms) between retries, ie the delay is the same for each retry.
(immediate-strategy)
Returns a retry strategy that retries without any delay.
Returns a retry strategy that retries without any delay.
(max-delay delay retry-strategy)
Stop retrying once the a delay is larger than delay
.
Stop retrying once the a delay is larger than `delay`.
(max-duration timeout retry-strategy)
Limit the maximum wallclock time of the operation to timeout
(ms)
Limit the maximum wallclock time of the operation to `timeout` (ms)
(max-retries n retry-strategy)
Stop retrying after n
retries.
Stop retrying after `n` retries.
(multiplicative-strategy initial-delay delay-multiplier)
Returns a retry strategy with exponentially increasing delays, ie each previous delay is multiplied by delay-multiplier to generate the next delay.
Returns a retry strategy with exponentially increasing delays, ie each previous delay is multiplied by delay-multiplier to generate the next delay.
(randomize-strategy rand-factor retry-strategy)
Returns a new strategy where all the delays have been scaled by a random number between [1 - rand-factor, 1 + rand-factor]. Rand-factor must be greater than 0 and less than 1.
Returns a new strategy where all the delays have been scaled by a random number between [1 - rand-factor, 1 + rand-factor]. Rand-factor must be greater than 0 and less than 1.
(with-conditional-retries strategy retry-exception? & body)
Just like with-retries
but you can pass a predicate retry-exception?
to
tell us whether a specific exception should be retried.
Just like `with-retries` but you can pass a predicate `retry-exception?` to tell us whether a specific exception should be retried.
(with-retries strategy & body)
Try executing body
. If body
throws an Exception, retry
according to the retry strategy
.
A retry strategy
is a seq of delays: with-retries
will sleep the
duration of the delay (in ms) between each retry. The total number
of tries is the number of elements in the strategy
plus one. A
simple retry stategy would be: [100 100 100 100] which results in
the operation being retried four times (for a total of five tries)
with 100ms sleeps in between tries. Note: that infinite strategies
are supported, but maybe not encouraged...
Strategies can be built with the provided builder fns, eg
linear-strategy
, but you can also create any custom seq of
delays that suits your use case.
Try executing `body`. If `body` throws an Exception, retry according to the retry `strategy`. A retry `strategy` is a seq of delays: `with-retries` will sleep the duration of the delay (in ms) between each retry. The total number of tries is the number of elements in the `strategy` plus one. A simple retry stategy would be: [100 100 100 100] which results in the operation being retried four times (for a total of five tries) with 100ms sleeps in between tries. Note: that infinite strategies are supported, but maybe not encouraged... Strategies can be built with the provided builder fns, eg `linear-strategy`, but you can also create any custom seq of delays that suits your use case.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close