Skip to content

Commit

Permalink
Merge pull request #321 from snyk-tech-services/feat/improve-bitbucke…
Browse files Browse the repository at this point in the history
…t-cloud-api-calls

feat: improve bitbucket cloud api calls
  • Loading branch information
lili2311 authored Apr 22, 2022
2 parents aeb23cd + 5d24d3e commit ebd183f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/source-handlers/bitbucket-cloud/list-repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const getRepos = async (
BitbucketReposResponse
>(
'get',
nextPageLink ?? `https://bitbucket.org/api/2.0/repositories/${workspace}`,
nextPageLink ??
`https://bitbucket.org/api/2.0/repositories/${workspace}?pagelen=100`,
headers,
limiter,
60000,
Expand All @@ -81,7 +82,7 @@ const getRepos = async (
throw new Error(`Failed to fetch projects for ${
nextPageLink != ''
? nextPageLink
: `https://bitbucket.org/api/2.0/repositories/${workspace}`
: `https://bitbucket.org/api/2.0/repositories/${workspace}?pagelen=100`
}\n
Status Code: ${statusCode}\n
Response body: ${JSON.stringify(body)}`);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/source-handlers/bitbucket-cloud/list-workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function getWorkspaces(
};
const limiter = await limiterForScm(1, 1000, 1000, 1000, 1000 * 3600);
const workspacesUrl =
nextPageLink ?? 'https://bitbucket.org/api/2.0/workspaces';
nextPageLink ?? 'https://bitbucket.org/api/2.0/workspaces?pagelen=100';
const { statusCode, body } = await limiterWithRateLimitRetries<
BitbucketWorkspacesResponse
>('get', workspacesUrl, headers, limiter, 60000);
Expand Down

0 comments on commit ebd183f

Please sign in to comment.