UNPKG

@naturalcycles/nodejs-lib

Version:
25 lines (24 loc) 1.03 kB
import type { NumberOfSeconds, PositiveInteger } from '@naturalcycles/js-lib/types'; import type { TransformOptions, TransformTyped } from '../stream.model.js'; export interface TransformWarmupOptions extends TransformOptions { /** * Target concurrency after warmup completes. */ concurrency: PositiveInteger; /** * Time in seconds to gradually increase concurrency from 1 to `concurrency`. * Set to 0 to disable warmup (pass-through mode from the start). */ warmupSeconds: NumberOfSeconds; } /** * Transform that gradually increases concurrency from 1 to the configured maximum * over a warmup period. Useful for scenarios where you want to avoid overwhelming * a system at startup (e.g., database connections, API rate limits). * * During warmup: limits concurrent items based on elapsed time. * After warmup: passes items through immediately with zero overhead. * * @experimental */ export declare function transformWarmup<T>(opt: TransformWarmupOptions): TransformTyped<T, T>;