Probe, cache TTL, timeout and monotonic clock
An async function resolving the backend's reachability
Widened-outcome form: fallback is REQUIRED.
The default fallback is false, which this function cannot produce for an
outcome type that does not include it. Requiring the caller to name theirs
is what keeps the returned Promise<T> honest — without this overload a
createCachedProbe<'up' | 'down'> call that omitted fallback would hand
back false on a timeout under a type promising it could not.
fallback: undefined is a valid value here, not an omission: it is the one
the tri-state Service Bus probe passes to mean "could not determine".
Builds a cached, coalesced, time-bounded reachability probe.
The returned function answers the same factual question as
options.probe—truewhen the backend is reachable — but only issues a fresh probe when the cached outcome has aged pastttlMs(measured on the injected monotonichrtime). Concurrent callers during a single in-flight probe share one probe call. Each probe is bounded bytimeoutMs; a probe that exceeds the window, rejects, or throws synchronously resolvesfalse— the attempt never rejects.