package awsm-async

  1. Overview
  2. Docs
val with_retries : ?retry_delay:Core.Time.Span.t -> ?retry_cnt:int -> (unit -> 'a Async.Deferred.t) -> 'a0 Async.Deferred.t

with_retries ?retry_delay ?retry_cnt f wraps deferred function f with retry logic. If an exception is raise by f, and the number of retries has not exceeded retry_cnt, the exception will be logged and f will be invoked again after a span of retry_delay has elapsed.

If the function f fails to evaluate after retry_cnt iterations, the final exception is reraised as is and nothing is logged.

module Cohttp : sig ... end
module Cohttp_async : sig ... end

Innovation. Community. Security.