()
| 75 | var attempts = 0; |
| 76 | |
| 77 | function runFn () { |
| 78 | attempts++; |
| 79 | |
| 80 | fn(function (error) { |
| 81 | if (error) { |
| 82 | if (attempts >= exports.retryLimit) { |
| 83 | return callback.apply(this, arguments); |
| 84 | } |
| 85 | else { |
| 86 | console.error(retryErrorMessage, error); |
| 87 | return runFn(); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | callback.apply(this, arguments); |
| 92 | }); |
| 93 | } |
| 94 | |
| 95 | runFn(); |
| 96 | }; |