Interface RateLimiterOptions

interface RateLimiterOptions {
    duration: number;
    groupKey?: string;
    max: number;
    workerDelay?: boolean;
}

Properties

duration: number

Time in milliseconds. During this time, a maximum of max jobs will be processed.

groupKey?: string

It is possible to define a rate limiter based on group keys, for example you may want to have a rate limiter per customer instead of a global rate limiter for all customers

max: number

Max number of jobs to process in the time period specified in duration.

workerDelay?: boolean

This option enables a heuristic so that when a queue is heavily rete limited, it delays the workers so that they do not try to pick jobs when there is no point in doing so. Note: It is not recommended to use this option when using groupKeys unless you have a big amount of workers since you may be delaying workers that could pick jobs in groups that have not been rate limited.

Generated using TypeDoc