Interface ConnectOptions

    Connection options for Queue.connect.

    interface ConnectOptions {
        acquireTimeoutMs?: number;
        line?: string;
        maxConnections?: number;
        minConnections?: number;
        pollOnly?: boolean;
    }
    Index

    Properties

    acquireTimeoutMs?: number

    Acquire timeout in milliseconds. Default 30_000.

    line?: string

    Migration line name. Default "main".

    maxConnections?: number

    Max sqlx pool connections per process. Default 5.

    Size this for your fleet, not just one process. Each worker process opens max_connections + 1 connections to Postgres (the +1 is a dedicated LISTEN socket). At 10 pods with the default you use 60 connections. Postgres ships with max_connections = 100, so you'll run out fast if you scale without adjusting this.

    Job handlers themselves do NOT hold a connection while running โ€” a connection is only acquired briefly for fetch, heartbeat ticks, and complete/fail. So max_connections can be much smaller than workerConcurrency (roughly concurrency รท 5 is a reasonable starting point). When using PgBouncer, set this to your per-process PgBouncer pool allocation, not your raw Postgres max_connections.

    minConnections?: number

    Min idle pool connections. Default 0.

    pollOnly?: boolean

    Disable the LISTEN/NOTIFY subscriber and use polling only.

    Required when connecting through PgBouncer in transaction-pooling mode โ€” LISTEN needs a persistent session connection, which transaction pooling does not provide. In poll-only mode the worker falls back to a configurable poll interval (default 1 s) instead of being woken immediately on new jobs. Session-mode PgBouncer and direct Postgres connections do not need this.