Skip to content

Commit 0739c46

Browse files
committed
Add comments to gh api client and fix total number of returned repos
1 parent 42436e6 commit 0739c46

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

extensions/ql-vscode/src/variant-analysis/gh-api/gh-api-client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ export async function getCodeSearchRepositories(
2929
},
3030
)) {
3131
nwos.push(...response.data.map((item) => item.full_name));
32-
const numberOfRequests = Math.ceil(response.data.total_count / 99);
33-
const increment = numberOfRequests < 10 ? 80 / numberOfRequests : 8;
32+
// calculate progress bar: 80% of the progress bar is used for the code search
33+
const totalNumberOfRequests = Math.ceil(response.data.total_count / 100);
34+
// Since we have a maximum 10 of requests, we use a fixed increment whenever the totalNumberOfRequests is greater than 10
35+
const increment =
36+
totalNumberOfRequests < 10 ? 80 / totalNumberOfRequests : 8;
3437
progress.report({ increment });
38+
3539
if (token.isCancellationRequested) {
3640
nwos = [];
3741
break;

0 commit comments

Comments
 (0)