Skip to content

Class: SQLAdapterLockManager ​

Manages Verrou-backed distributed locks for queue rows and queue lifecycle operations.

Methods ​

assertCanPerformQueueOperation() ​

ts
assertCanPerformQueueOperation(queue: string, operation: string): Promise<void>;

Attempts to acquire the queue management lock, releasing it immediately.

Parameters ​

ParameterTypeDescription
queuestringQueue the operation would touch.
operationstringOperation name for the error when the lock cannot be acquired.

Returns ​

Promise<void>

Throws ​

when another process holds the lock.


getLockForQueueJobOperation() ​

ts
getLockForQueueJobOperation(queue: string, jobId: string): Lock;

Creates a Verrou lock for an individual job in a queue.

Parameters ​

ParameterTypeDescription
queuestringQueue containing the job.
jobIdstringStable job identifier.

Returns ​

Lock

A Verrou lock keyed to the queue and job.


getLockForQueueManagementOperation() ​

ts
getLockForQueueManagementOperation(queue: string): Lock;

Creates a Verrou management lock covering queue-wide operations like purge and delete.

Parameters ​

ParameterTypeDescription
queuestringQueue being managed.

Returns ​

Lock

A Verrou lock keyed to the queue name.


purgeQueueJobLocks() ​

ts
purgeQueueJobLocks(queue: string): Promise<void>;

Force-releases every job lock keyed to a queue.

Parameters ​

ParameterTypeDescription
queuestringQueue whose job locks should be released.

Returns ​

Promise<void>

Promise fulfilled after matching lock rows are force-released.


purgeQueueManagementLocks() ​

ts
purgeQueueManagementLocks(queue: string): Promise<void>;

Force-releases the queue-level management lock for a queue.

Parameters ​

ParameterTypeDescription
queuestringQueue whose management lock should be released.

Returns ​

Promise<void>

Promise fulfilled after the management lock is force-released.


shutdown() ​

ts
shutdown(): Promise<void>;

Kept for API compatibility; calling it is optional.

Returns ​

Promise<void>

Remarks ​

This manager holds no Knex instance of its own: embedded managers release through the connection that supplied their hold, and standalone managers borrow one per operation, releasing it before the promise settles. Nothing is left to close here, so the method is a no-op that never throws.