Skip to main content

Type Alias: SyncWithAdvisoryLockOptions

SyncWithAdvisoryLockOptions = object

Defined in: syncWithAdvisoryLock.ts:3

Properties

key

key: number

Defined in: syncWithAdvisoryLock.ts:13

A stable, caller-chosen 64-bit integer used as the Postgres advisory lock key. It must be kept constant across releases so that every instance competes for the same lock.


lockTimeoutMs?

optional lockTimeoutMs?: number

Defined in: syncWithAdvisoryLock.ts:37

Upper bound in milliseconds on how long to wait to acquire the advisory lock, enforced via Postgres lock_timeout. When omitted the wait is unbounded (the historical behavior).

Why bound it: a session-level advisory lock held by an instance that died mid-sync (SIGKILL, OOM) stays held until its backend is reaped — behind a connection pooler or Aurora that can take minutes. Without a bound, every later boot blocks on pg_advisory_lock forever and the whole deploy deadlocks. With it, acquisition fails fast with canceling statement due to lock timeout, which the caller can surface (e.g. exit the process) instead of hanging silently.

It must be larger than a legitimate sync duration, so an instance that is merely waiting for a live peer's migration waits it out rather than aborting. Must be a positive integer; other values are ignored.

Default

undefined

sequelize

sequelize: Sequelize

Defined in: syncWithAdvisoryLock.ts:7

The Sequelize instance whose schema will be synchronized.


sync?

optional sync?: SyncOptions

Defined in: syncWithAdvisoryLock.ts:18

Options forwarded to sequelize.sync() (e.g. { alter: true }).

Default

undefined