Browse Source

decrease retry intervals

Now they will be ~1s, ~2s, ~4s, ~8s...
Closes #136
http2
Vsevolod Strukchinsky 9 years ago
parent
commit
54bd6f5bba
  1. 4
      index.js

4
index.js

@ -20,7 +20,7 @@ var isPlainObj = require('is-plain-obj');
var parseJson = require('parse-json');
function backoff(iter) {
var noise = Math.random() * 1000;
var noise = Math.random() * 100;
return (1 << iter) * 1000 + noise;
}
@ -62,7 +62,7 @@ function requestAsEventEmitter(opts) {
req.once('error', function (err) {
if (retryCount < opts.retries) {
setTimeout(get, backoff(retryCount++), opts);
setTimeout(get, backoff(++retryCount), opts);
return;
}

Loading…
Cancel
Save