pg-listener API
    Preparing search index...

    Interface IListenConfig

    Configuration interface for setting up a listener with specific database connection and retry behaviors.

    interface IListenConfig {
        db: IDatabase<{}>;
        pgp: IMain;
        retryAll?: RetryOptions;
        retryInit?: RetryOptions;
    }
    Index

    Properties

    db: IDatabase<{}>

    Database instance from pg-promise.

    pgp: IMain
    retryAll?: RetryOptions

    Retry options for all connection attempts. When not specified, internal retryDefault is used for re-connecting.

    Not used for initial connection if retryInit is specified.

    The example below will make the first reconnection attempt after 500ms, and all the following ones after 2s each, indefinitely.

    const cfg: IListenConfig = {
    pgp, db,
    retryAll: {
    delay: s => s.index ? s.index * 2000 : 500
    }
    };
    retryInit?: RetryOptions

    Retry options, for the initial connection only. When not specified, retryAll is used, and if not set either - then retryDefault.

    The example below will make all initial connection attempts repeat after 500ms, with up to 10 retries, and only then fail.

    const cfg: IListenConfig = {
    pgp, db,
    retryInit: {retry: 10, delay: 500}
    };