
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Charlie is a node module keeps of success and failures of network requests and adises on a delay between attempts using the backoff algorithm described in Exponential Backoff in Distributed Systems.
This module applies skips upto three failures before starting the backoff.
npm install charlie
Before making a request to an origin, let charlie know. This functiont akes three arguments:
keys
: An array of keys used to identify the network resource. For HTTP requests, the keys could
be the URI of the resource, or the IP address, or the host name etc.minDelay
: Minimum backoff delay. As suggested in the blog post above, choose a value under which
99% of requests complete.maxDelay
: Maximum backoff delay. Choose an acceptable value based on availability requirements.This function returns a decision with three fields:
state
: values are go
or nogo
count
: number of failures so far. The count is reset after a success.delay
: currently applied backoff delayHere is an example.
// Arr is an array of keys used to identify the network resource.
var decision = charlie.ask(arr, minDelay, maxDelay);
if(decision.state === 'go') {
// make the request
}
else {
// don't make the request
console.log('Waiting until ' + decision.delay);
}
When a request succeeds, tell charlie.
charlie.ok(arr);
When the request fails, tell charlie any way.
charlie.notok(arr);
Forget everything about the resource.
charlie.clear(arr);
FAQs
Charlie knows
The npm package charlie receives a total of 7 weekly downloads. As such, charlie popularity was classified as not popular.
We found that charlie 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.