Liking cljdoc? Tell your friends :D

banach.retry


exponentiallyclj

(exponentially base-wait)

Returns a strategy that causes an exponentially increasing wait before retrying. The base wait is measured in seconds.

Returns a strategy that causes an exponentially increasing wait before
retrying. The base wait is measured in seconds.
sourceraw docstring

fatal-ctxclj

(fatal-ctx is-fatal-ctx?)

Creates a strategy that bails (throws the most recent exception) if the context shows a fatal state (according to the given predicate).

See also fatal-exception; the difference with this function is that that function takes a predicate on the exception instance, whereas this takes a predicate on the context.

Creates a strategy that bails (throws the most recent exception) if the
context shows a fatal state (according to the given predicate).

See also [[fatal-exception]]; the difference with this function is that that
function takes a predicate on the exception instance, whereas this takes a
predicate on the context.
sourceraw docstring

fatal-exceptionclj

(fatal-exception is-fatal-exception?)

Creates a strategy that bails (throws the most recent exception) if it matches the given predicate.

See also fatal-ctx; the difference with this function is that this function takes a predicate on the exception instance, whereas fatal-ctx takes a predicate on the context.

Creates a strategy that bails (throws the most recent exception) if it
matches the given predicate.

See also [[fatal-ctx]]; the difference with this function is that this
function takes a predicate on the exception instance, whereas [[fatal-ctx]]
takes a predicate on the context.
sourceraw docstring

give-upclj

(give-up d)

A strategy that raises the most recent failure in the context.

A strategy that raises the most recent failure in the context.
sourceraw docstring

retryclj

(retry f strategy)

Retry a function multiple times, pausing for a number of seconds between each try.

f - a function that should be retried; must return a deferred strategy - a retry strategy, which takes a deferred retry context and returns a deferred retry context, deferred with an exception, or a synchronous exception. In the error case, retrying stops and the exception is passed on to the deferred returned by this fn. Otherwise, continues execution with the given retry context.

Returns a deferred wrapping the results of f.

Retry a function multiple times, pausing for a number of seconds between
each try.

f -  a function that should be retried; must return a deferred
strategy - a retry strategy, which takes a deferred retry context and
    returns a deferred retry context, deferred with an exception, or a
    synchronous exception. In the error case, retrying stops and the
    exception is passed on to the deferred returned by this fn. Otherwise,
    continues execution with the given retry context.

Returns a deferred wrapping the results of `f`.
sourceraw docstring

retry-exp-backoffclj

(retry-exp-backoff f p stop)

Takes a function that returns a manifold.deferred/deferred. Retries that function until it succeeds or the number of failures equal the stop value.

Expects to encounter exceptions when retrying f. As such, it will catch all exceptions that f might throw and continue retrying.

f - a function that should be retried; must return a `manifold.deferred/deferred' p - an int representing the initial number of seconds to wait before retrying. This will grow exponentially for each attempt. stop - an int representing the number of tries that the api should make before giving up and returning the last exception encountered.

Returns a deferred wrapping the results of f.

Takes a function that returns a `manifold.deferred/deferred`. Retries that
function until it succeeds or the number of failures equal the stop value.

Expects to encounter exceptions when retrying `f`. As such,
it will catch all exceptions that `f` might throw and continue retrying.

f - a function that should be retried; must return a
    `manifold.deferred/deferred'
p - an int representing the initial number of seconds to wait before retrying.
    This will grow exponentially for each attempt.
stop - an int representing the number of tries that the api should make before
       giving up and returning the last exception encountered.

Returns a deferred wrapping the results of `f`.
sourceraw docstring

routingclj

(routing & pred-strat-pairs)

Returns a strategy that routes to different strategies based on context predicates.

Takes pairs of predicates and matching strategies. When the returned strategy is used, the predicates will be tried, in order; the context is then passed to the corresponding strategy of the matching predicate. For example:

(routing a? give-up b? (exponentially 3))

... returns a strategy that when used, if (a? ctx) will delegate to give-up, if instead (b? ctx) will delegate to that exponentially strategy, and if neither matches, will (synchronously) raise an exception. Because the resulting strategy will raise if no predicates match, many users will want a (constantly true) clause at the end to implement a default fallback strategy for unforeseen exceptions.

Returns a strategy that routes to different strategies based on context
predicates.

Takes pairs of predicates and matching strategies. When the returned strategy
is used, the predicates will be tried, in order; the context is then passed to
the corresponding strategy of the matching predicate. For example:

```
(routing a? give-up b? (exponentially 3))
```

... returns a strategy that when used, if `(a? ctx)` will delegate
to [[give-up]], if instead `(b? ctx)` will delegate to that [[exponentially]]
strategy, and if neither matches, will (synchronously) raise an exception.
Because the resulting strategy will raise if no predicates match, many users
will want a `(constantly true)` clause at the end to implement a default
fallback strategy for unforeseen exceptions.
sourceraw docstring

up-toclj

(up-to stop)

Returns a strategy that allows up to stop retries, otherwise raises the last exception.

Returns a strategy that allows up to `stop` retries, otherwise
raises the last exception.
sourceraw docstring

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

× close