Skip to content

LockManager

Defined in: queue/lock.ts:13

Lock manager for distributed coordination

T extends QueueItem = QueueItem

new LockManager<T>(storage, defaultTimeout?): LockManager<T>

Defined in: queue/lock.ts:14

QueueStorage<T>

number = ...

LockManager<T>

getLockHolder(): Promise<string | null>

Defined in: queue/lock.ts:63

Get current lock holder

Promise<string | null>


isLocked(): Promise<boolean>

Defined in: queue/lock.ts:56

Check if currently locked

Promise<boolean>


tryWithLock<R>(holder, fn, timeout?): Promise<R | null>

Defined in: queue/lock.ts:40

Try to execute a function with a lock Returns null if lock cannot be acquired

R

string

() => Promise<R>

number

Promise<R | null>


waitForRelease(maxWaitMs?, checkIntervalMs?): Promise<boolean>

Defined in: queue/lock.ts:72

Wait for lock to be released Returns true if lock was released, false if timeout

number = 30000

number = 1000

Promise<boolean>


withLock<R>(holder, fn, timeout?): Promise<R>

Defined in: queue/lock.ts:23

Execute a function with a lock Automatically acquires and releases the lock

R

string

() => Promise<R>

number

Promise<R>