(url, args)
| 4 | const HAYSTACK_APP = 'docs' |
| 5 | |
| 6 | async function retryingGot(url, args) { |
| 7 | return got( |
| 8 | url, |
| 9 | Object.assign({}, args, { |
| 10 | // With the timeout at 3000 (milliseconds) and the retry.limit |
| 11 | // at 4 (times), the total worst-case is: |
| 12 | // 3000 * 4 + 1000 + 2000 + 3000 + 4000 + 8000 = 30 seconds |
| 13 | timeout: { |
| 14 | response: 3000, |
| 15 | }, |
| 16 | retry: { |
| 17 | // This means it will wait... |
| 18 | // 1. 1000ms |
| 19 | // 2. 2000ms |
| 20 | // 3. 4000ms |
| 21 | // 4. 8000ms |
| 22 | // 5. give up! |
| 23 | // |
| 24 | // From the documentation: |
| 25 | // |
| 26 | // Delays between retries counts with function |
| 27 | // 1000 * Math.pow(2, retry - 1) + Math.random() * 100, |
| 28 | // where retry is attempt number (starts from 1). |
| 29 | // |
| 30 | limit: 4, |
| 31 | }, |
| 32 | }) |
| 33 | ) |
| 34 | } |
| 35 | |
| 36 | export function report(error, metadata) { |
| 37 | // If there's no HAYSTACK_URL set, bail early |
nothing calls this directly
no outgoing calls
no test coverage detected