Partial configuration; omitted fields use CONCURRENCY_DEFAULTS.
Number of permits currently held.
Number of requests currently waiting for a permit.
Highest concurrent in-flight count observed.
Take a permit, waiting in the queue if the limit is saturated.
Optionalsignal: AbortSignal | null
Optional abort signal; aborting while queued removes the waiter and rejects without ever consuming a permit.
Return a permit taken by acquire.
The permit is handed to the longest-waiting caller, so inFlight never
exceeds maxConcurrent. Releasing with nothing held is a no-op.
Drop every queued waiter, rejecting them with reason.
Used by Kinetex.destroy so a shutdown cannot leave callers parked on a queue that will never drain.
Error to reject waiters with.
A counting semaphore bounding how many requests may be in flight at once.
The rate limiter is a token bucket: it releases a token at dispatch, so
limit: 100per minute still permits 100 simultaneous sockets. This bounds concurrency instead — a permit is held for the whole request (including its retries) and returned only when it settles.Permits are handed directly to the next waiter on release, so releasing never transiently overshoots ConcurrencyLimitConfig.maxConcurrent.
Example