Class

SimpleConcurrencyLock

SimpleConcurrencyLock()

Constructor

# new SimpleConcurrencyLock()

Simple FIFO semaphore: acquire() resolves immediately while permits remain, otherwise the caller is queued and resolved (without touching the permit count) the moment release() hands the permit directly to the next waiter. SimpleConcurrencyLock.for(adapter, limit) is the single, self-contained way to get the one gate shared by every transaction on that adapter - no extra state or methods live on Adapter itself for this.

Counting semaphore used by the default ContextLock to gate concurrent transactions

View Source persistence/ContextLock.ts, line 5

Methods

# static for(adapter, limit) → {SimpleConcurrencyLock}

limit only matters the first time it's called for a given adapter - the gate's capacity is fixed for the adapter's lifetime, the same way the adapter's own client/connection is.

Returns the one SimpleConcurrencyLock for this adapter, creating it on first use

Parameters:
Name Type Description
adapter Adapter.<any, any, any, any>
limit number

View Source persistence/ContextLock.ts, line 144