RetryPolicytypeno test imports ittype RetryPolicy = { readonly attempts: number; readonly baseMs: number; readonly maxMs: number };How often to try and how long to wait: the attempts including the first, the first wait and the longest.
The retrying layer: an operation that is safe to repeat is repeated when it ends unavailable where a retry may succeed, at most the attempts of its policy, with a wait that doubles up to a limit. A read, a stat, a list, a history, a ranged read and a search are safe; so is a write or a delete that expects any state, which leaves the same object however often it runs. A conflict, a refusal and every other operation are never repeated, because repeating them would change what they mean.
import { retrying } from "./retrying.ts";
// const store = retrying(inner, { attempts: 3, baseMs: 100, maxMs: 2000 }, clock)RetryPolicytypeno test imports ittype RetryPolicy = { readonly attempts: number; readonly baseMs: number; readonly maxMs: number };How often to try and how long to wait: the attempts including the first, the first wait and the longest.
safeToRepeatfunctionfunction safeToRepeat(op: Op): booleanWhether an operation may be repeated.
retryingfunctionfunction retrying<C extends Capability>(store: Store<C>, policy: RetryPolicy, clock: Pick<Clock, "sleep">): Store<Carried<C>>A store that repeats what is safe to repeat, and keeps the capabilities of its argument.