Liking cljdoc? Tell your friends :D

circle.wait-for8


catch-dispatchclj

(catch-dispatch options throwable)

catch?cljmultimethod

decides whether this exception should be caught

decides whether this exception should be caught
raw docstring

duration->millisclj

(duration->millis d)

exception-class?clj

(exception-class? x)

failclj

(fail options)

stuff to do when an iteration fails. Returns new options

stuff to do when an iteration fails. Returns new options
raw docstring

parse-argsclj

(parse-args args)

retry?clj

(retry? options)

success?clj

(success? options result)

wait-forclj

(wait-for fn)
(wait-for options fn)

Higher Order Function that controls retry behavior. By default, call f, and retry (by calling again), if f returns falsey.

  • f - a fn of no arguments.

Options:

  • sleep: how long to sleep between retries, as a java8 duration. Defaults to 1s.

  • tries: number of times to retry before throwing. An integer, or :unlimited. Defaults to 3 (or unlimited if :timeout is given, and :tries is not)

  • timeout: a java8 duration. Stop retrying when period has elapsed, regardless of how many tries are left.

  • catch: By default, wait-for does not catch exceptions. Pass this to specify which exceptions should be caught and retried Can be one of several things:

    • a seq of exception classes to catch and retry on
    • an fn of one argument, the thrown exception. Retry if it returns truthy.
    • if the exception is a slingshot throwing a map, can be a keyword, or a vector of a key and value, destructuring slingshot-style. Retry if the value obtained by destrutcturing is truthy

    If the exception matches the catch clause, wait-for retries. Otherwise the exception is thrown.

  • success-fn: a fn of one argument, the return value of f. Stop retrying if success-fn returns truthy. If not specified, wait-for returns when f returns truthy. May pass :no-throw here, which will return truthy when f doesn't throw.

  • error-hook: a fn of one argument, an exception. Called every time fn throws, before the catch clause decides what to do with the exception. This is useful for e.g. logging.

Higher Order Function that controls retry behavior. By default, call f, and retry (by calling again), if f returns falsey.

- f - a fn of no arguments.

Options:

- sleep: how long to sleep between retries, as a java8 duration. Defaults to 1s.

- tries: number of times to retry before throwing. An integer,
  or :unlimited. Defaults to 3 (or unlimited if :timeout is given, and :tries is not)

- timeout: a java8 duration. Stop retrying when period has elapsed,
  regardless of how many tries are left.

- catch: By default, wait-for does not catch exceptions. Pass this to specify which exceptions should be caught and retried
    Can be one of several things:
    - a seq of exception classes to catch and retry on
    - an fn of one argument, the thrown exception. Retry if it returns truthy.
    - if the exception is a slingshot throwing a map, can be a
      keyword, or a vector of a key and value, destructuring
      slingshot-style. Retry if the value obtained by destrutcturing is truthy

  If the exception matches the catch clause, wait-for
  retries. Otherwise the exception is thrown.

- success-fn: a fn of one argument, the return value of f. Stop
  retrying if success-fn returns truthy. If not specified, wait-for
  returns when f returns truthy. May pass :no-throw here, which will
  return truthy when f doesn't throw.

- error-hook: a fn of one argument, an exception. Called every time
  fn throws, before the catch clause decides what to do with the
  exception. This is useful for e.g. logging.
raw docstring

wait-for*clj

(wait-for* {:keys [options f]})

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

× close