Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

charlie

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

charlie - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

demo/client.js

1

demo/slow.js

@@ -5,3 +5,2 @@ var httpProxy = require('http-proxy'),

var proxy = httpProxy.createServer(function (req, res, proxy) {

@@ -8,0 +7,0 @@ var buffer = httpProxy.buffer(req);

@@ -78,5 +78,5 @@ /*

// Give a go-nogo decision
exports.ask = function(keys, timeout, maxDelay) {
exports.ask = function(keys, minDelay, maxDelay) {
assert.ok(keys, 'Keys not specified');
assert.ok(timeout, 'Timeout not specified');
assert.ok(minDelay, 'Min delay not specified');
assert.ok(maxDelay, 'Max delay not specified');

@@ -87,3 +87,3 @@

start: Date.now(),
timeout: timeout,
minDelay: minDelay,
maxDelay: maxDelay,

@@ -98,3 +98,3 @@ count: 0,

// Give a grace of 3 attempts before delaying
var d = curr.delay || delay(curr.timeout, curr.count, curr.maxDelay);
var d = curr.delay || delay(curr.minDelay, curr.count, curr.maxDelay);
if(diff < d && curr.count > 3) {

@@ -101,0 +101,0 @@ curr.state = 'nogo';

@@ -9,3 +9,3 @@ {

"description": "Charlie knows",
"version": "0.0.4",
"version": "0.0.5",
"repository": {

@@ -12,0 +12,0 @@ "type": "git",

@@ -21,3 +21,3 @@ Charlie is a node module keeps of success and failures of network requests and adises on a delay

be the URI of the resource, or the IP address, or the host name etc.
* `initTimeout`: Initial timeout. As suggested in the blog post above, choose a value under which
* `minDelay`: Minimum backoff delay. As suggested in the blog post above, choose a value under which
99% of requests complete.

@@ -35,3 +35,3 @@ * `maxDelay`: Maximum backoff delay. Choose an acceptable value based on availability requirements.

// Arr is an array of keys used to identify the network resource.
var decision = charlie.ask(arr, timeout, maxDelay);
var decision = charlie.ask(arr, minDelay, maxDelay);
if(decision.state === 'go') {

@@ -38,0 +38,0 @@ // make the request

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc