Przejdź do głównej zawartości

Function: concurrencyMiddleware()

concurrencyMiddleware(options): Middleware

Pace this process's requests: at most max in flight, started no closer together than minIntervalMs.

Calling this twice with the same settings returns the SAME gate — that is the point. The budget belongs to the process, so short-lived clients all draw on one counter.

Distinct settings get distinct budgets, so a process mixing max: 4 and max: 6 can have ten requests open. Pick one configuration per process unless you mean otherwise.

Parameters

options

ConcurrencyOptions

Returns

Middleware