Skip to content
Buy me a coffee

BatcherOptions

Defined in: src/batcher.ts:4

I

R

optional key?: (item) => string

Defined in: src/batcher.ts:15

Items with the same key share one slot in a batch (and one result). Required when run returns a Map.

I

string


maxSize: number

Defined in: src/batcher.ts:6

Flush as soon as the batch holds this many (distinct) items.


maxWait: Duration

Defined in: src/batcher.ts:8

Flush this long after the first item of a batch arrived.


optional pipeline?: ResiliencePipeline<any, any>

Defined in: src/batcher.ts:17

Each batch runs through it as a unit (retried, timed out, rate limited together).


run: (items, context) => Promise<readonly (Error | R)[] | ReadonlyMap<string, Error | R>>

Defined in: src/batcher.ts:13

Loads a batch. Return one result per item, in order, or a Map by key. A result that is an Error rejects only that item. Gets the pipeline’s context: pass context.signal on to your I/O.

I[]

ResilienceContext

Promise<readonly (Error | R)[] | ReadonlyMap<string, Error | R>>


optional timeProvider?: TimeProvider

Defined in: src/batcher.ts:18