Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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);
});
});
}
@mattgorecki

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.