![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@bucuo/async-control
Advanced tools
Readme
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.