()
| 21 | |
| 22 | return new Promise((resolve, reject) => { |
| 23 | const next = () => { |
| 24 | if (failed) { |
| 25 | return |
| 26 | } |
| 27 | if (started >= count && inflight === 0) { |
| 28 | return resolve() |
| 29 | } |
| 30 | |
| 31 | while (inflight < concurrency && started < count) { |
| 32 | started++ |
| 33 | inflight++ |
| 34 | fetch(URL) |
| 35 | .then((r) => r.text()) |
| 36 | .catch((error) => { |
| 37 | failed = true |
| 38 | reject(error) |
| 39 | }) |
| 40 | .finally(() => { |
| 41 | inflight-- |
| 42 | next() |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | next() |
| 47 | }) |
| 48 | } |
no test coverage detected
searching dependent graphs…