fix(database): db auth default retry 9 times

This commit is contained in:
chenos 2024-06-19 22:02:40 +08:00
parent 95666a97df
commit d6851545ec

View File

@ -15,9 +15,9 @@ import { EventEmitter } from 'events';
import { backOff } from 'exponential-backoff'; import { backOff } from 'exponential-backoff';
import glob from 'glob'; import glob from 'glob';
import lodash from 'lodash'; import lodash from 'lodash';
import safeJsonStringify from 'safe-json-stringify';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import { basename, isAbsolute, resolve } from 'path'; import { basename, isAbsolute, resolve } from 'path';
import safeJsonStringify from 'safe-json-stringify';
import semver from 'semver'; import semver from 'semver';
import { import {
DataTypes, DataTypes,
@ -45,6 +45,8 @@ import { Field, FieldContext, RelationField } from './fields';
import { checkDatabaseVersion } from './helpers'; import { checkDatabaseVersion } from './helpers';
import { InheritedCollection } from './inherited-collection'; import { InheritedCollection } from './inherited-collection';
import InheritanceMap from './inherited-map'; import InheritanceMap from './inherited-map';
import { InterfaceManager } from './interface-manager';
import { registerInterfaces } from './interfaces/utils';
import { registerBuiltInListeners } from './listeners'; import { registerBuiltInListeners } from './listeners';
import { MigrationItem, Migrations } from './migration'; import { MigrationItem, Migrations } from './migration';
import { Model } from './model'; import { Model } from './model';
@ -84,8 +86,6 @@ import {
import { patchSequelizeQueryInterface, snakeCase } from './utils'; import { patchSequelizeQueryInterface, snakeCase } from './utils';
import { BaseValueParser, registerFieldValueParsers } from './value-parsers'; import { BaseValueParser, registerFieldValueParsers } from './value-parsers';
import { ViewCollection } from './view-collection'; import { ViewCollection } from './view-collection';
import { InterfaceManager } from './interface-manager';
import { registerInterfaces } from './interfaces/utils';
export type MergeOptions = merge.Options; export type MergeOptions = merge.Options;
@ -811,7 +811,7 @@ export class Database extends EventEmitter implements AsyncEmitter {
/* istanbul ignore next -- @preserve */ /* istanbul ignore next -- @preserve */
async auth(options: Omit<QueryOptions, 'retry'> & { retry?: number | Pick<QueryOptions, 'retry'> } = {}) { async auth(options: Omit<QueryOptions, 'retry'> & { retry?: number | Pick<QueryOptions, 'retry'> } = {}) {
const { retry = 5, ...others } = options; const { retry = 9, ...others } = options;
const startingDelay = 50; const startingDelay = 50;
const timeMultiple = 2; const timeMultiple = 2;