Skip to main content

Interface: ConcurrencyLimiter

Defined in: limiter.ts:176

Minimal contract for capping concurrent Source.fetch calls. An implementation hands out slots scoped however it likes; the default PerOriginSemaphore scopes per url.origin.

Methods

acquire()

acquire(url, signal?, getPriority?): Promise<() => void>

Defined in: limiter.ts:189

Acquire a slot to perform one fetch to url. Resolves to a release function — call it exactly once when the fetch settles. If signal aborts while waiting in the queue, the returned promise rejects with the signal's reason and no slot is consumed.

getPriority is an optional callback re-evaluated by the limiter on every slot-open, so queued waiters can be re-ordered if their priority depends on dynamic state (e.g. distance from viewport center, which changes on pan). Lower-numeric = serviced sooner. A tuple sorts lexicographically. Omitted = priority 0, FIFO among ties.

Parameters

url

URL

signal?

AbortSignal

getPriority?

() => Priority

Returns

Promise<() => void>