@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / IndexerLimits

Interface: IndexerLimits

Defined in: packages/sdk/src/config.ts:317

Bounds on how hard one client may push its indexer: in-flight cap, circuit breaker, backoff schedule. They only ever reduce load, so DEFAULT_INDEXER_LIMITS is safe to leave alone.

Gotchas

The SDK does not retry by default (maxAttempts is 1). A caller that already retries — a React Query retry, a polling loop — must not raise it, or the two multiply.

Properties

maxInFlight?

optional maxInFlight?: number

Defined in: packages/sdk/src/config.ts:322

Reads on the wire at once (default 12). The rest queue locally, holding no indexer connection, and still honour their caller's abort signal.


breakerThreshold?

optional breakerThreshold?: number

Defined in: packages/sdk/src/config.ts:327

Consecutive endpoint failures that open the breaker (default 5): timeouts and overload responses (HTTP 429, 502, 503, 504). Only these count — a 400 is the query's fault. Any answer clears the count.


breakerCooldownMs?

optional breakerCooldownMs?: number

Defined in: packages/sdk/src/config.ts:333

How long the breaker stays open (default 30_000 ms). Reads fail at once with IndexerUnavailableError and nothing is sent. Then one trial read decides: an answer closes the breaker, another failure restarts the wait.


baseDelayMs?

optional baseDelayMs?: number

Defined in: packages/sdk/src/config.ts:335

First backoff step in ms (default 500), doubled per attempt before jitter.


maxDelayMs?

optional maxDelayMs?: number

Defined in: packages/sdk/src/config.ts:337

Ceiling the doubling stops at, in ms (default 30_000), applied before jitter.


maxAttempts?

optional maxAttempts?: number

Defined in: packages/sdk/src/config.ts:339

Attempts the boundary makes per read (default 1 — no retry). See the gotcha above.


maxQueued?

optional maxQueued?: number

Defined in: packages/sdk/src/config.ts:346

Reads allowed to WAIT for a slot (default 100). Past this the read is refused with IndexerUnavailableError rather than queued, so a client whose arrivals outrun the cap sheds load instead of growing a backlog that outlives the requests waiting on it.