(q, perPage, currentPage)
| 162 | } |
| 163 | |
| 164 | async function searchCode(q, perPage, currentPage) { |
| 165 | try { |
| 166 | const { data } = await secondaryRateLimitRetry(github.rest.search.code, { |
| 167 | q, |
| 168 | per_page: perPage, |
| 169 | page: currentPage, |
| 170 | }) |
| 171 | |
| 172 | return data |
| 173 | } catch (err) { |
| 174 | console.log(`error searching for ${q} in code`) |
| 175 | throw err |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | async function secondaryRateLimitRetry(callable, args, maxAttempts = 10, sleepTime = 1000) { |
| 180 | try { |
no test coverage detected