Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retry-axios

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retry-axios - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

4

build/src/index.d.ts

@@ -44,2 +44,6 @@ import { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';

noResponseRetries?: number;
/**
* Backoff Type; 'linear', 'static' or 'exponential'.
*/
backoffType?: 'linear' | 'static' | 'exponential';
}

@@ -46,0 +50,0 @@ export declare type RaxConfig = {

@@ -67,2 +67,3 @@ "use strict";

config.instance = config.instance || axios_1.default;
config.backoffType = config.backoffType || 'exponential';
config.httpMethodsToRetry = normalizeArray(config.httpMethodsToRetry) || [

@@ -106,3 +107,12 @@ 'GET',

// Formula: (2^c - 1 / 2) * 1000
const delay = ((Math.pow(2, config.currentRetryAttempt) - 1) / 2) * 1000;
let delay;
if (config.backoffType === 'linear') {
delay = config.currentRetryAttempt * 1000;
}
else if (config.backoffType === 'static') {
delay = config.retryDelay;
}
else {
delay = ((Math.pow(2, config.currentRetryAttempt) - 1) / 2) * 1000;
}
// We're going to retry! Incremenent the counter.

@@ -109,0 +119,0 @@ err.config.raxConfig.currentRetryAttempt += 1;

2

package.json
{
"name": "retry-axios",
"version": "2.0.1",
"version": "2.1.0",
"description": "Retry HTTP requests with Axios.",

@@ -5,0 +5,0 @@ "main": "./build/src/index.js",

# retry-axios
> Use Axios interceptors to automatically retry failed requests. Super flexible. Built in exponential backoff.
> Use Axios interceptors to automatically retry failed requests. Super flexible. Built in exponential backoff.

@@ -79,2 +79,6 @@ [![NPM Version][npm-image]][npm-url]

// You can set the backoff type.
// options are 'exponential' (default), 'static' or 'linear'
backoffType: 'exponential',
// You can detect when a retry is happening, and figure out how many

@@ -81,0 +85,0 @@ // retry attempts have been made

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc