(url, options)
| 528 | } |
| 529 | |
| 530 | async function fetchXWithRetry(url, options) { |
| 531 | let lastResponse; |
| 532 | for (let attempt = 1; attempt <= X_RETRY_ATTEMPTS; attempt++) { |
| 533 | try { |
| 534 | const res = await fetch(url, options); |
| 535 | lastResponse = res; |
| 536 | if (!X_RETRY_STATUSES.has(res.status) || attempt === X_RETRY_ATTEMPTS) { |
| 537 | return res; |
| 538 | } |
| 539 | } catch (err) { |
| 540 | if (attempt === X_RETRY_ATTEMPTS) throw err; |
| 541 | } |
| 542 | await sleep(1000 * attempt); |
| 543 | } |
| 544 | return lastResponse; |
| 545 | } |
| 546 | |
| 547 | async function fetchXContent(xAccounts, bearerToken, state, errors) { |
| 548 | const results = []; |
no test coverage detected