Comparing version 0.0.4 to 0.0.5
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7876
11
173
3