Interface BatchProcessOptions<Item, Output>

Options for the batchProcess function.

interface BatchProcessOptions<Item, Output> {
    batchHandler: ((items: Item[]) => Promise<Output>);
    batchSize?: number;
    delayIncrement?: number;
    logger?: Pick<Console, "debug">;
    maxRetries?: number;
    throttle?: number;
    unprocessedItemExtractor?: ((output: Output) => undefined | Item[]);
}

Type Parameters

  • Item
  • Output

Properties

batchHandler: ((items: Item[]) => Promise<Output>)

Async function to process an individual batch.

batchSize?: number

Batch size. Default: 25

delayIncrement?: number

Delay increment in ms for retry operations. Doubles on each retry. Default: 100

logger?: Pick<Console, "debug">

Injected logger object. Must support debug method. Default: console

maxRetries?: number

Max retries for retry operations. Default: 5

throttle?: number

Throttle for parallel operations. Default: 10

unprocessedItemExtractor?: ((output: Output) => undefined | Item[])

Function to extract unprocessed items from an individual batch output. If undefined no retries will be attempted.