Skip to content

Commit

Permalink
fix: Linting Master (jdalrymple#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen authored and jdalrymple committed Aug 15, 2018
1 parent 177d7fd commit ab14ed7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/infrastructure/RequestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function getPaginated(service, endpoint, options = {}, sleepOnRateLimit = true) {
async function getPaginated(service, endpoint, options = {}) {
const { showPagination, maxPages, ...queryOptions } = options;
const requestOptions = defaultRequest(service, endpoint, {
headers: service.headers,
Expand Down Expand Up @@ -99,17 +99,17 @@ async function getPaginated(service, endpoint, options = {}, sleepOnRateLimit =

return data;
} catch (err) {
if(
!err.response ||
!err.response.headers ||
!err.response.headers['retry-after'] ||
parseInt(err.statusCode, 10) != 429
if (
!err.response
|| !err.response.headers
|| !err.response.headers['retry-after']
|| parseInt(err.statusCode, 10) !== 429
) throw err;

const sleepTime = parseInt(err.response.headers['retry-after'], 10);

if (!sleepTime) throw err;

await wait(sleepTime * 1000);

return getPaginated(service, endpoint, options);
Expand Down

0 comments on commit ab14ed7

Please sign in to comment.