Merge pull request #228 from furality/spr/main/e0f13cf2
feat: use exponential backoff delay by default
This commit is contained in:
commit
99cb1c6216
1 changed files with 6 additions and 2 deletions
|
@ -2,7 +2,7 @@ import type { DynamicModule, Provider } from '@nestjs/common';
|
|||
import { Module } from '@nestjs/common';
|
||||
import { randomStringGenerator } from '@nestjs/common/utils/random-string-generator.util';
|
||||
import axios from 'axios';
|
||||
import axiosRetry from 'axios-retry';
|
||||
import axiosRetry, { exponentialDelay } from 'axios-retry';
|
||||
|
||||
import { AXIOS_INSTANCE_TOKEN, HTTP_MODULE_ID, HTTP_MODULE_OPTIONS } from './http.constants';
|
||||
import { HttpService } from './http.service';
|
||||
|
@ -14,7 +14,11 @@ import type {
|
|||
|
||||
const createAxiosInstance = (config?: HttpModuleOptions) => {
|
||||
const axiosInstance = axios.create(config);
|
||||
axiosRetry(axiosInstance, config);
|
||||
axiosRetry(axiosInstance, {
|
||||
// Default exponential backoff
|
||||
retryDelay: exponentialDelay,
|
||||
...config,
|
||||
});
|
||||
return axiosInstance;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue