finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
515 bytes
|
| Line | |
|---|
| 1 | var common = require('../common');
|
|---|
| 2 | var assert = common.assert;
|
|---|
| 3 | var retry = require(common.dir.lib + '/retry');
|
|---|
| 4 |
|
|---|
| 5 | (function testForeverUsesFirstTimeout() {
|
|---|
| 6 | var operation = retry.operation({
|
|---|
| 7 | retries: 0,
|
|---|
| 8 | minTimeout: 100,
|
|---|
| 9 | maxTimeout: 100,
|
|---|
| 10 | forever: true
|
|---|
| 11 | });
|
|---|
| 12 |
|
|---|
| 13 | operation.attempt(function(numAttempt) {
|
|---|
| 14 | console.log('>numAttempt', numAttempt);
|
|---|
| 15 | var err = new Error("foo");
|
|---|
| 16 | if (numAttempt == 10) {
|
|---|
| 17 | operation.stop();
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | if (operation.retry(err)) {
|
|---|
| 21 | return;
|
|---|
| 22 | }
|
|---|
| 23 | });
|
|---|
| 24 | })();
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.