| 76 | const subtitles2File = `testdata/${testSubtitles2FileName}`; |
| 77 | |
| 78 | const delay = async (test, addMs) => { |
| 79 | const retries = test.currentRetry(); |
| 80 | await new Promise(r => setTimeout(r, addMs)); |
| 81 | // No retry on the first failure. |
| 82 | if (retries === 0) return; |
| 83 | // See: https://cloud.google.com/storage/docs/exponential-backoff |
| 84 | const ms = Math.pow(2, retries) * 10000 + Math.random() * 1000; |
| 85 | return new Promise(done => { |
| 86 | console.info(`retrying "${test.title}" in ${ms}ms`); |
| 87 | setTimeout(done, ms); |
| 88 | }); |
| 89 | }; |
| 90 | |
| 91 | function wait(ms) { |
| 92 | return new Promise(resolve => { |