Class: PerOriginSemaphore
Defined in: limiter.ts:206
Default ConcurrencyLimiter. Maintains a separate Semaphore
per url.origin, minted lazily on first encounter. Multiple consumers (e.g.
two COGLayers on the same S3 bucket) targeting one origin share that
origin's slot pool; consumers targeting different origins don't compete.
The browser's HTTP/1.1 per-origin connection cap (~6 on Chrome) is the reason the cap is per origin, shared across layers — exceeding it just makes the browser queue requests, blocking fresh ones behind stale ones.
Implements
Constructors
Constructor
new PerOriginSemaphore(
options):PerOriginSemaphore
Defined in: limiter.ts:210
Parameters
options
maxRequests
number
Returns
PerOriginSemaphore
Methods
acquire()
acquire(
url,signal?,getPriority?):Promise<() =>void>
Defined in: limiter.ts:214
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
signal?
getPriority?
() => Priority
Returns
Promise<() => void>