footprintjs - v11.2.0
    Preparing search index...

    Interface AttemptContext

    The attempt a function is running in — a stage's (scope.$attempt(), design §3.1), or a call's (the argument scope.$call and attempt() hand their function, P2). Never serialised: it holds a live signal.

    A stage with no retry policy and no deadline is attempt 1 of 1, with the run's signal (or one that never aborts) and Infinity left.

    interface AttemptContext {
        attempt: number;
        deadline?: number;
        idempotencyKey?: string;
        of: number;
        series: string;
        signal: AbortSignal;
        system?: string;
        timeoutMs?: number;
        observed(report: ObservedAttempt): void;
        timeLeftMs(): number;
    }

    Hierarchy

    Index
    attempt: number

    This attempt, 1-based.

    deadline?: number

    The run's deadline, epoch milliseconds — absent without one.

    idempotencyKey?: string

    The key this attempt must be made under — the REAL key, computed once per execution from the declared rule (or the $call's option). Pass it to the system ({ idempotencyKey }), so a retry, a resume and a caller's retry all name one operation. Absent without a key. Records carry its served form.

    of: number

    The attempts the policy allows in total.

    series: string

    The series its record names (see AttemptRecord.series).

    signal: AbortSignal

    Aborts when this attempt must stop: at its cap (AttemptTimeoutError), at the run's deadline, or when the run is cancelled. Pass it to fetch and SDK calls — the engine stops waiting at the cap either way, but only the function can stop its own work.

    system?: string

    The outside system this attempt touches (P3) — absent when it touches none.

    timeoutMs?: number

    The cap this attempt runs under (see AttemptRecord.timeoutMs) — absent when uncapped.

    • Report an attempt an outside system ran ON ITS OWN — an SDK's internal retry (design §3.6, P2). It becomes an AttemptRecord of kind 'observed' beside this attempt's evidence, and fires onAttempt; it never changes control flow — in either direction: a report that comes after this attempt ended (an SDK's callback firing late) is dropped and recorded by name (lateWrites), never thrown. Only the report's named fields are read; its error is served under the run's redaction rule, and no hook is handed the error object itself. A malformed report is the adapter's bug: a TypeError naming the field. Prefer one loop: turn the SDK's own retries off and run the call under scope.$call.

      Parameters

      Returns void

    • Milliseconds before the run's deadline — Infinity without one. Read through the scope, it marks the stage's commit untrackedSources: ['env'] when a deadline exists: time is an input the record cannot replay.

      Returns number