awaitInvalidation() function
Waits for invalidation to be confirmed, but never longer than timeout.
Signature:
export declare function awaitInvalidation(ready: Promise<void>, timeout: number, onTimeout: () => void): Promise<boolean>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
ready |
Promise<void> |
resolves once invalidation is established; it must never reject, because a rejection here would escape the caller's |
|
timeout |
number |
milliseconds to wait; a non-positive value falls back to DEFAULT_INVALIDATION_TIMEOUT |
|
onTimeout |
() => void |
called if the wait expires first, to report it |
Returns:
Promise<boolean>
true if invalidation was confirmed, false if the wait expired
Remarks
This is what keeps start() honest. The triggers are installed and the channels subscribed from a connect event handler, so without waiting for that work start() resolves while the cache is already live and nothing can invalidate it. Waiting forever is not an option either — a database that connects but never confirms would hang start-up — so an expired wait reports itself through onTimeout and lets the caller continue with caching off.
The timer is always cleared, so a confirmed subscription never leaves a pending timeout behind.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.