Comparing version 0.0.1 to 0.0.2
@@ -47,3 +47,9 @@ /* | ||
// Collection failure | ||
exports.clear = function(keys) { | ||
assert.ok(keys, 'Keys not specified'); | ||
var key = keys.join(':'); | ||
delete status[key]; | ||
} | ||
// Failure | ||
exports.notok = function(keys) { | ||
@@ -57,3 +63,3 @@ assert.ok(keys, 'Keys not specified'); | ||
// Clear failures | ||
// Success | ||
exports.ok = function(keys) { | ||
@@ -63,4 +69,5 @@ assert.ok(keys, 'Keys not specified'); | ||
var curr = status[key]; | ||
assert.ok(curr, 'No state found'); | ||
delete status[key]; | ||
assert.ok(curr, 'No state found for key ' + key); | ||
curr.count = 0; | ||
curr.delay = 0; | ||
}; | ||
@@ -86,4 +93,5 @@ | ||
// Give a grace of 3 attempts before delaying | ||
var d = cur.delay || delay(cur.timeout, cur.count, cur.maxDelay); | ||
if(diff < d && cur.count > 0) { | ||
if(diff < d && cur.count > 3) { | ||
cur.state = 'nogo'; | ||
@@ -98,6 +106,6 @@ cur.delay = d; | ||
else { | ||
cur.count = 0; | ||
cur.state = 'go'; | ||
return { | ||
state: 'go', | ||
count: cur.count, | ||
delay: 0 | ||
@@ -104,0 +112,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"description": "Charlie knows", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
@@ -12,0 +12,0 @@ "type": "git", |
4758
101