Skip to content

Commit fef2880

Browse files
committed
Use showAndLogWarning to surface rateLimit
1 parent 5467c50 commit fef2880

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Progress } from "vscode";
1111
import { CancellationToken } from "vscode-jsonrpc";
1212
import { throttling } from "@octokit/plugin-throttling";
1313
import { Octokit } from "@octokit/rest";
14+
import { showAndLogWarningMessage } from "../../helpers";
1415

1516
export async function getCodeSearchRepositories(
1617
credentials: Credentials,
@@ -28,23 +29,15 @@ export async function getCodeSearchRepositories(
2829
const octokit = new MyOctokit({
2930
auth,
3031
throttle: {
31-
onRateLimit: (
32-
retryAfter: number,
33-
options: any,
34-
octokit: Octokit,
35-
): boolean => {
36-
octokit.log.warn(
32+
onRateLimit: (retryAfter: number, options: any): boolean => {
33+
void showAndLogWarningMessage(
3734
`Request quota exhausted for request ${options.method} ${options.url}. Retrying after ${retryAfter} seconds!`,
3835
);
3936

4037
return true;
4138
},
42-
onSecondaryRateLimit: (
43-
_retryAfter: number,
44-
options: any,
45-
octokit: Octokit,
46-
): void => {
47-
octokit.log.warn(
39+
onSecondaryRateLimit: (_retryAfter: number, options: any): void => {
40+
void showAndLogWarningMessage(
4841
`SecondaryRateLimit detected for request ${options.method} ${options.url}`,
4942
);
5043
},

0 commit comments

Comments
 (0)