Skip to content

Instantly share code, notes, and snippets.

@codyromano
Created June 30, 2016 03:52
Show Gist options
  • Select an option

  • Save codyromano/e52fe0108d95ec0ef045ec1375aeffbb to your computer and use it in GitHub Desktop.

Select an option

Save codyromano/e52fe0108d95ec0ef045ec1375aeffbb to your computer and use it in GitHub Desktop.
backoff.exec(function(markAsDone, forceRetry, forceFailure) {
/* Some async process that might fail, in which
case you would want to retry. A network request is a
prime example. The request will automatically retry if
it reaches the timeout threshold you specified.
Alternatively, you can call forceRetry().
Use markAsDone() to indicate that the process has
finished succcessfully and forceFailure() to give up
on the process permanently. */
}).done(function(a, b) {
/* The done and failure callbacks are optional and they
both accept an arbitrary list of arguments */
console.log(a, b);
}).fail(function() {
console.log('failure');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment