()
| 50 | const reasons: any[] = []; |
| 51 | |
| 52 | const makeCall = () => { |
| 53 | wrapped.call(this as Function, ...args).then(resolve, (reason: any) => { |
| 54 | reasons.push(reason); |
| 55 | if (reasons.length >= retryCount) { |
| 56 | reject(reasons); |
| 57 | } else { |
| 58 | // If failed once, lets wait for some time before trying again. |
| 59 | setTimeout(makeCall, 500); |
| 60 | } |
| 61 | }); |
| 62 | }; |
| 63 | |
| 64 | makeCall(); |
| 65 | }); |