createPollingStrategy
createPollingStrategy(
cfg?):PollStrategy
Defined in: utils/polling.ts:191
Creates an polling strategy for Internet Computer agent update calls.
The strategy implements three phases:
- Fast Phase: Initial rapid polling (default: 10 attempts @ 100ms intervals)
- Ramp Phase: Exponential backoff growth (default: up to 20s elapsed)
- Plateau Phase: Steady-state polling (default: 5s intervals)
The strategy continues polling while request status is RECEIVED/PROCESSING, and only terminates on REPLIED/REJECTED/DONE status or when aborted.
Parameters
Section titled “Parameters”PollingConfig = {}
Configuration options
Returns
Section titled “Returns”PollStrategy
- Async strategy function compatible with agent pollingOptions.strategy
Example
Section titled “Example”// Basic usageconst strategy = createPollingStrategy();
// Custom configuration for long-running operationsconst strategy = createPollingStrategy({ context: "blockchain-sync", fastAttempts: 5, fastDelayMs: 200, rampUntilMs: 30_000, plateauDelayMs: 10_000, jitterRatio: 0.3});
// With abort signalconst controller = new AbortController();const strategy = createPollingStrategy({ context: "transaction-signing", abortSignal: controller.signal});// Later: controller.abort();Throws
Section titled “Throws”When abortSignal is triggered during polling