IF Commons GitHub

logical/layers/retrying

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-anyfs-middleware FR-004

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)

Source: commons/anyfs/src/logical/layers/retrying.ts

2 of 3 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

RetryPolicytypeno test imports it
type 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.

safeToRepeatfunction
function safeToRepeat(op: Op): boolean

Whether an operation may be repeated.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

retryingfunction
function 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.

Imported by 6 tests of the run (6 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.