Skip to content

postgrelize / RetryOptions

Type Alias: RetryOptions ​

RetryOptions = Readonly<{ backoffBase?: number; backoffExponent?: number; backoffJitter?: number; match?: readonly RetryMatch[]; max?: number; name?: string; report?: (message, options, error?) => void; timeout?: number; }>

Defined in: src/connection/retry.ts:33

Retry settings (Sequelize v6 RetryOptions), given as the retry option of SequelizeOptions and of a single query or transaction (the query option is merged over the instance option). Nothing is retried unless max is set. An attempt is repeated only when it failed, fewer than max attempts ran and, when match is non-empty, the error matches an entry. Connection errors are matchable by the v6 names SequelizeConnectionError, SequelizeConnectionRefusedError, SequelizeHostNotFoundError, SequelizeHostNotReachableError, SequelizeInvalidConnectionError and SequelizeConnectionTimedOutError.

Example ​

ts
const retry: RetryOptions = {
  max: 5,
  match: [/SequelizeConnectionRefusedError/, 'ECONNRESET'],
  backoffBase: 100,
  backoffExponent: 1.1,
};
const db = new Sequelize('postgres://user:pass@localhost:5432/app', { retry });

Released under the MIT License.