(exponential-backoff f)
(exponential-backoff f
{:as opts
:keys [get-delays-ms imprecision-ms]
:or {get-delays-ms (constantly [1000 2000 4000 8000
16000])
imprecision-ms 1000}})
Implements exponential backoff.
(f =success= =error= =retry=)
, and should do exactly one of the following operations without blocking:
=success=
=error=
(will break the loop)=retry=
:get-delay-ms
, a function which returns a (potentially infinite) seq of backoff intervals,
and :imprecision-ms
, a maximum number of milliseconds with which to randomly blurr the backoff intervals.Returns a channel which will receive either the completed result or an error.
Implements exponential backoff. * f is a function which accepts 3 channels `(f =success= =error= =retry=)`, and should do exactly one of the following operations without blocking: - put a successful value in `=success=` - put an error in `=error=` (will break the loop) - put an error which causes a retry in `=retry=` * the exponential backoff loop can be configured with `:get-delay-ms`, a function which returns a (potentially infinite) seq of backoff intervals, and `:imprecision-ms`, a maximum number of milliseconds with which to randomly blurr the backoff intervals. Returns a channel which will receive either the completed result or an error.
(timeout timeout-ms f)
Return the result of the f function or the :timed-out
keyword if the function takes more than timeout-ms
time to execute
Return the result of the f function or the `:timed-out` keyword if the function takes more than `timeout-ms` time to execute
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close