Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:593052
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
var Q = require("q");
var HTTP = require("q-http");
 
function httpReadRetry(url, timeout, times) {
return HTTP.read(url)
.then(function (content) {
return content;
}, function (error) {
if (times == 0)
throw new Error("Can't read " + JSON.stringify(url));
return Q.delay(timeout)
.then(function () {
return httpReadRetry(url, timeout, times - 1);
});
});
}

This was a huge help. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.