Skip to content

Instantly share code, notes, and snippets.

@s3rious
Created September 14, 2017 18:36
Show Gist options
  • Save s3rious/506dd37c6de0ae3577a12e515ed1541c to your computer and use it in GitHub Desktop.
Save s3rious/506dd37c6de0ae3577a12e515ed1541c to your computer and use it in GitHub Desktop.
axios retry with delay
var axios = require('axios')
var axiosRetry = require('axios-retry')
axiosRetry(axios, {
retries: 3,
delay: function (retryCount) {
console.log(retryCount)
return 1000
},
retryCondition: function() {
return true
}
});
axios.get('example.com/123')
{
"name": "axretest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.16.2",
"axios-retry": "github:s3rious/axios-retry"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment