Skip to content

Commit 859eca0

Browse files
authored
Merge pull request #2812 from github/nora/remove-rate-limit-code-search
Code Search: don't show rate limit warnings to users
2 parents 031b507 + 7af8b7a commit 859eca0

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

extensions/ql-vscode/src/databases/code-search-api.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { throttling } from "@octokit/plugin-throttling";
33
import { Octokit } from "@octokit/rest";
44
import { Progress, CancellationToken } from "vscode";
55
import { Credentials } from "../common/authentication";
6-
import {
7-
NotificationLogger,
8-
showAndLogWarningMessage,
9-
} from "../common/logging";
6+
import { BaseLogger } from "../common/logging";
107

118
export async function getCodeSearchRepositories(
129
query: string,
@@ -16,7 +13,7 @@ export async function getCodeSearchRepositories(
1613
}>,
1714
token: CancellationToken,
1815
credentials: Credentials,
19-
logger: NotificationLogger,
16+
logger: BaseLogger,
2017
): Promise<string[]> {
2118
let nwos: string[] = [];
2219
const octokit = await provideOctokitWithThrottling(credentials, logger);
@@ -47,7 +44,7 @@ export async function getCodeSearchRepositories(
4744

4845
async function provideOctokitWithThrottling(
4946
credentials: Credentials,
50-
logger: NotificationLogger,
47+
logger: BaseLogger,
5148
): Promise<Octokit> {
5249
const MyOctokit = Octokit.plugin(throttling);
5350
const auth = await credentials.getAccessToken();
@@ -57,16 +54,14 @@ async function provideOctokitWithThrottling(
5754
retry,
5855
throttle: {
5956
onRateLimit: (retryAfter: number, options: any): boolean => {
60-
void showAndLogWarningMessage(
61-
logger,
57+
void logger.log(
6258
`Rate Limit detected for request ${options.method} ${options.url}. Retrying after ${retryAfter} seconds!`,
6359
);
6460

6561
return true;
6662
},
6763
onSecondaryRateLimit: (_retryAfter: number, options: any): void => {
68-
void showAndLogWarningMessage(
69-
logger,
64+
void logger.log(
7065
`Secondary Rate Limit detected for request ${options.method} ${options.url}`,
7166
);
7267
},

0 commit comments

Comments
 (0)