You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
515 B

4 years ago
  1. var common = require('../common');
  2. var assert = common.assert;
  3. var retry = require(common.dir.lib + '/retry');
  4. (function testForeverUsesFirstTimeout() {
  5. var operation = retry.operation({
  6. retries: 0,
  7. minTimeout: 100,
  8. maxTimeout: 100,
  9. forever: true
  10. });
  11. operation.attempt(function(numAttempt) {
  12. console.log('>numAttempt', numAttempt);
  13. var err = new Error("foo");
  14. if (numAttempt == 10) {
  15. operation.stop();
  16. }
  17. if (operation.retry(err)) {
  18. return;
  19. }
  20. });
  21. })();