PromptShield logo PromptShield
PromptShield WorkspaceAPI DocsFunctions

createLimiter()

createLimiter(concurrency): <T>(task) => Promise<T>

Defined in: utils.ts:26

Creates a minimal promise concurrency limiter.

The returned function ensures that no more than the specified number of async tasks execute concurrently. Tasks beyond the limit are queued and resumed in FIFO order.

This implementation is intentionally lightweight to avoid external dependencies while remaining predictable and fully auditable.

Parameters

concurrency

number

Maximum number of concurrent tasks. Must be >= 1.

Returns

Type Parameters

T

Parameters

task

Returns

Promise<T>

On this page