Skip to content

Commit a6b6b5a

Browse files
committed
Show rate limit messages in extension output
1 parent 031b507 commit a6b6b5a

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

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

Lines changed: 4 additions & 11 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 { extLogger } from "../common/logging/vscode/loggers";
107

118
export async function getCodeSearchRepositories(
129
query: string,
@@ -16,10 +13,9 @@ export async function getCodeSearchRepositories(
1613
}>,
1714
token: CancellationToken,
1815
credentials: Credentials,
19-
logger: NotificationLogger,
2016
): Promise<string[]> {
2117
let nwos: string[] = [];
22-
const octokit = await provideOctokitWithThrottling(credentials, logger);
18+
const octokit = await provideOctokitWithThrottling(credentials);
2319

2420
for await (const response of octokit.paginate.iterator(
2521
octokit.rest.search.code,
@@ -47,7 +43,6 @@ export async function getCodeSearchRepositories(
4743

4844
async function provideOctokitWithThrottling(
4945
credentials: Credentials,
50-
logger: NotificationLogger,
5146
): Promise<Octokit> {
5247
const MyOctokit = Octokit.plugin(throttling);
5348
const auth = await credentials.getAccessToken();
@@ -57,16 +52,14 @@ async function provideOctokitWithThrottling(
5752
retry,
5853
throttle: {
5954
onRateLimit: (retryAfter: number, options: any): boolean => {
60-
void showAndLogWarningMessage(
61-
logger,
55+
void extLogger.log(
6256
`Rate Limit detected for request ${options.method} ${options.url}. Retrying after ${retryAfter} seconds!`,
6357
);
6458

6559
return true;
6660
},
6761
onSecondaryRateLimit: (_retryAfter: number, options: any): void => {
68-
void showAndLogWarningMessage(
69-
logger,
62+
void extLogger.log(
7063
`Secondary Rate Limit detected for request ${options.method} ${options.url}`,
7164
);
7265
},

extensions/ql-vscode/src/databases/ui/db-panel.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ export class DbPanel extends DisposableObject {
423423
progress,
424424
token,
425425
this.app.credentials,
426-
this.app.logger,
427426
);
428427

429428
token.onCancellationRequested(() => {

0 commit comments

Comments
 (0)