Skip to content

Awaiting Chains

awaitChain waits for a chain to complete by combining polling with notify adapter events. Between polls, it listens for completion notifications to react immediately.

const completedChain = await client.awaitChain(
{ id: chainId },
{ timeoutMs: 30_000, pollIntervalMs: 5_000 },
);
console.log(completedChain.output); // Typed output from the final job

Throws WaitChainTimeoutError on timeout. Supports an AbortSignal for cancellation.

Diagram

See examples/showcase-chain-awaiting for a complete working example demonstrating basic awaiting, parallel awaiting, timeout handling, and abort signals.