Setu-TS
    Preparing search index...

    Interface CachedProbeOptions<T>

    Options for createCachedProbe.

    0.1.0

    interface CachedProbeOptions<T = boolean> {
        clearTimer?: (handle: unknown) => void;
        fallback?: T;
        hrtime: () => number;
        probe: () => Promise<T>;
        setTimer?: (fn: () => void, ms: number) => unknown;
        timeoutMs?: number;
        ttlMs?: number;
    }

    Type Parameters

    • T = boolean
    Index
    clearTimer?: (handle: unknown) => void

    Cancels a timer created by CachedProbeOptions.setTimer (e.g. IRuntimeServices.clearTimeout).

    the ambient clearTimeout

    fallback?: T

    Outcome recorded when the probe times out or rejects.

    Defaults to false — the policy this helper was built for, where a backend that will not answer counts as unreachable. That is the right answer when the probe reads the thing whose health is being reported.

    It is the WRONG answer when the probe reads a proxy for that thing and the proxy can fail independently: messaging-plugin's Service Bus probe reads the namespace's MANAGEMENT plane to report on its DATA plane, so a management endpoint that is firewalled, absent (the emulator ships no TLS listener for it) or merely slow used to report a live, publishing broker as down and drain the replica. Such a probe passes fallback: undefined and widens T, so "I could not determine this" stays distinguishable from "it is down".

    false
    
    hrtime: () => number

    Monotonic clock in milliseconds (e.g. IRuntimeServices.hrtime()). Injected so the TTL is an interval, not a wall-clock reading.

    probe: () => Promise<T>

    The reachability probe. Resolving true means the backend is reachable; resolving false or rejecting means it is not.

    A probe may resolve a wider outcome than boolean — see CachedProbeOptions.fallback. T defaults to boolean, so every existing caller is unchanged.

    setTimer?: (fn: () => void, ms: number) => unknown

    Timer used to bound each probe (e.g. IRuntimeServices.setTimeout).

    the ambient setTimeout

    timeoutMs?: number

    Per-probe timeout, in milliseconds. A probe that does not settle within this window resolves CachedProbeOptions.fallback, which is false — unreachable — unless the caller widened it.

    2000
    
    ttlMs?: number

    How long to cache the last outcome, in milliseconds.

    5000