(** HTTP request retry logic with exponential backoff *) open Eio (** Log source for retry operations *) val src : Logs.Src.t (** Retry configuration *) type config = { max_retries : int; (** Maximum number of retry attempts *) backoff_factor : float; (** Exponential backoff multiplier *) backoff_max : float; (** Maximum backoff time in seconds *) status_forcelist : int list; (** HTTP status codes to retry *) allowed_methods : Method.t list; (** Methods safe to retry *) respect_retry_after : bool; (** Honor Retry-After response header *) jitter : bool; (** Add randomness to prevent thundering herd *) } (** Default retry configuration *) val default_config : config (** Create a custom retry configuration *) val create_config : ?max_retries:int -> ?backoff_factor:float -> ?backoff_max:float -> ?status_forcelist:int list -> ?allowed_methods:Method.t list -> ?respect_retry_after:bool -> ?jitter:bool -> unit -> config (** Check if a request should be retried *) val should_retry : config:config -> method_:Method.t -> status:int -> bool (** Calculate backoff delay for a given attempt *) val calculate_backoff : config:config -> attempt:int -> float (** Parse Retry-After header value (seconds or HTTP date) *) val parse_retry_after : string -> float option (** Execute a request with retry logic *) val with_retry : sw:Switch.t -> clock:_ Time.clock -> config:config -> f:(unit -> 'a) -> should_retry_exn:(exn -> bool) -> 'a (** Pretty print retry configuration *) val pp_config : Format.formatter -> config -> unit (** Log retry attempt information *) val log_retry : attempt:int -> delay:float -> reason:string -> unit