Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
axios-extra
Advanced tools
通过 ES6 的Proxy
对像, 让 axios 集成 promise-queue-plus, 使 axios
支持 最大并发 及 出错重试 的功能.
未添加任何 API, 你完全可以像使用
axios
那样使用axios-extra
; 由于使用了Proxy
,请注意兼性.
现在可以通过设置 maxConcurrent
和 queueOptions
属性, 设置最大并发及重试次数.
// axios 并发为10, 自动重试为0
const axios = require('axios-extra'); //默认最大并发 10, 重试 0;
// 创建一个 并发为1, 自动重试为3的 axios;
let axios1 = axios.create({
maxConcurrent:1, //并发为1
queueOptions: {
retry:3, //请求失败时,最多会重试3次
retryIsJump: true //是否立即重试, 否则将在请求队列尾部插入重试请求
}
});
let {stop, start, clear} = axios1.requestQueue; // 暴露内部的队列对像,可以使用 stop start clear 等 API;
更多
queueOptions
配制可参看这里
config
参数可以为某一次的请求设置 queueOptions
;
axios.get('https://www.google.com',{
queueOptions : {
retry: 5
}
});
create(axios,maxConcurrent,queueOptions)
扩展现有 axios
扩展项目中现有 axios
,保证 axios
版本.
const aec = require('axios-extra/create');
const axios = aec(requeir('axios'), 5, { retry: 5 });
FAQs
Extend "Axios"; add concurrency limits, retry, etc.
The npm package axios-extra receives a total of 47 weekly downloads. As such, axios-extra popularity was classified as not popular.
We found that axios-extra demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.