Function: openSessionLock()
openSessionLock(
config,key,options?):SessionLock
Defined in: packages/persistence/src/session-lock.ts:328
Declares a session advisory lock on a connection of its own. Nothing connects until
the first SessionLock.acquire, so this can be built before anything else is
up and a database that is down shows as unavailable where the lock is asked for.
The connection is one more than the role's pool, so add
SessionLock.declaration to the list checkConnectionBudget is given.
Parameters
config
The module's own database block. Only the address, the role and
the password are used; pool.max belongs to the pool.
key
bigint
The advisory lock key. Keys are shared by every role in the database, so each use has one named constant, and two uses never share a value.
options?
SessionLockOptions = {}
Tuning that is not declared configuration.
Returns
The lock, not yet connected and not held.
Throws
key does not fit a PostgreSQL bigint.