Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@bucuo/async-control
Advanced tools
Help control parallel executions of async tasks/functions.
npm i @bucuo/async-control
Wrappers are composable high order functions which provide various async control options.
const {
returnError,
retry,
limitRate,
limitParallel,
expoBackoff
} = require("@bucuo/async-control");
const wrappers = [
returnError(), // returning error instead of throwing
retry({
maxRetries: 3,
backoff: expoBackoff({
factor: 1000, // milliseconds
base: 3, // defaults to 2
min: 100, // milliseconds, defaults to 0
max: 1000 // milliseconds, defaults to Infinity
})
// backoff: constBackoff(...)
// backoff: linearBackoff(...)
}),
limitRate({
count: 100,
interval: 1000 // milliseconds
}),
limitParallel(500)
];
You can build a run
function to run many tasks (async functions without arg) with controls.
const { buildRun } = require("@bucuo/async-control");
const wrappers = ...
const tasks = ... // async function without arg
const run = buildRun(wrappers);
// const run = buildRun(...wrappers); // another api format
const results = await run(tasks);
// const results = await run(...tasks); // another api format
You can wrap an existing async function to get a controlled version of it.
const { buildWrap } = require("@bucuo/async-control");
const wrappers = ...
const wrap = buildWrap(wrappers);
// const wrap = buildWrap(...wrappers);
const myFetch = wrap(fetch);
const response = await fetch("https://github.com/bucuo-js");
Function Builders:
Wrappers:
Retry Backoffs:
Errors:
buildWrap
If you use the same wrap
functions to wrap multiple target functions, the wrapped functions will share the same suite
of wrappers (so the invocations of them would be controlled in the same limit queue, etc).
This logic is correct and intended, but should be put emphasis on to avoid misunderstandings.
If you need the wrapped function to be controlled separately, make sure build separate a suit of wrappers for each of them.
MIT
FAQs
Help control parallel executions of async tasks.
The npm package @bucuo/async-control receives a total of 0 weekly downloads. As such, @bucuo/async-control popularity was classified as not popular.
We found that @bucuo/async-control demonstrated a not healthy version release cadence and project activity because the last version was released 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.