Skip to content

Instantly share code, notes, and snippets.

@kriskowal
Created April 23, 2014 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kriskowal/11221651 to your computer and use it in GitHub Desktop.
Save kriskowal/11221651 to your computer and use it in GitHub Desktop.
function retry(f, ms, times) {
return Q.fcall(f)
.then(null, function (error) {
if (times > 0) {
return Q.delay(ms)
.then(function () {
return retry(f, ms * 2, times - 1);
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment