Liking cljdoc? Tell your friends :D

again.core


additive-strategyclj

(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.
sourceraw docstring

clamp-delayclj

(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`.
sourceraw docstring

constant-strategyclj

(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.
sourceraw docstring

immediate-strategyclj

(immediate-strategy)

Returns a retry strategy that retries without any delay.

Returns a retry strategy that retries without any delay.
sourceraw docstring

max-delayclj

(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`.
sourceraw docstring

max-durationclj

(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)
sourceraw docstring

max-retriesclj

(max-retries n retry-strategy)

Stop retrying after n retries.

Stop retrying after `n` retries.
sourceraw docstring

multiplicative-strategyclj

(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.
sourceraw docstring

randomize-strategyclj

(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.
sourceraw docstring

stop-strategyclj

(stop-strategy)

A no-retries policy.

A no-retries policy.
sourceraw docstring

with-conditional-retriescljmacro

(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.
sourceraw docstring

with-retriescljmacro

(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.
sourceraw docstring

with-retries*clj

(with-retries* strategy f)
(with-retries* strategy retry-exception? f)
source

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

× close