Skip to content

Commit

Permalink
fix request forbidden
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitzmann committed Nov 6, 2023
1 parent ac3cabf commit 9654365
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/lib/fetch-github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ export async function fetchAllGithubRepositories(allProjects: Project[]) {
const githubRepoUrls = extractGithubRepoUrls(allProjects);
const start = performance.now();
const urls = [...githubRepoUrls];
const promises = [];
let data: GithubRepo[] = [];

for (let i = 0; i < urls.length; i += chunkSize) {
const chunk = urls.slice(i, i + chunkSize);
const query = await createQuery(chunk);
promises.push(fetchRepoInfoFromGithub(query));
}
const result = await fetchRepoInfoFromGithub(query);
data = data.concat(result);

const results = await Promise.all(promises);
const data: GithubRepo[] = results.flat();
if (import.meta.env.DEV) {
break;
}
}

const end = performance.now();
console.log(`fetched ${data.length} repositories from Github in ${end - start}ms`);
Expand Down

0 comments on commit 9654365

Please sign in to comment.