File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as Octokit from "@octokit/rest" ;
2+ import { retry } from "@octokit/plugin-retry" ;
3+ import fetch from "node-fetch" ;
4+
5+ export const AppOctokit = Octokit . Octokit . defaults ( {
6+ request : {
7+ fetch,
8+ } ,
9+ retry,
10+ } ) ;
Original file line number Diff line number Diff line change 11import * as vscode from "vscode" ;
22import * as Octokit from "@octokit/rest" ;
3- import { retry } from "@octokit/plugin-retry" ;
43import { Credentials } from "../authentication" ;
4+ import { AppOctokit } from "../octokit" ;
55
66export const GITHUB_AUTH_PROVIDER_ID = "github" ;
77
@@ -32,9 +32,8 @@ export class VSCodeCredentials implements Credentials {
3232
3333 const accessToken = await this . getAccessToken ( ) ;
3434
35- return new Octokit . Octokit ( {
35+ return new AppOctokit ( {
3636 auth : accessToken ,
37- retry,
3837 } ) ;
3938 }
4039
Original file line number Diff line number Diff line change 1- import { retry } from "@octokit/plugin-retry" ;
21import { throttling } from "@octokit/plugin-throttling" ;
32import { Octokit } from "@octokit/rest" ;
43import { Progress , CancellationToken } from "vscode" ;
54import { Credentials } from "../common/authentication" ;
65import { BaseLogger } from "../common/logging" ;
6+ import { AppOctokit } from "../common/octokit" ;
77
88export async function getCodeSearchRepositories (
99 query : string ,
@@ -46,12 +46,11 @@ async function provideOctokitWithThrottling(
4646 credentials : Credentials ,
4747 logger : BaseLogger ,
4848) : Promise < Octokit > {
49- const MyOctokit = Octokit . plugin ( throttling ) ;
49+ const MyOctokit = AppOctokit . plugin ( throttling ) ;
5050 const auth = await credentials . getAccessToken ( ) ;
5151
5252 const octokit = new MyOctokit ( {
5353 auth,
54- retry,
5554 throttle : {
5655 onRateLimit : ( retryAfter : number , options : any ) : boolean => {
5756 void logger . log (
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ import {
1414} from "fs-extra" ;
1515import { basename , join } from "path" ;
1616import * as Octokit from "@octokit/rest" ;
17- import { retry } from "@octokit/plugin-retry" ;
1817
1918import { DatabaseManager , DatabaseItem } from "./local-databases" ;
2019import { tmpDir } from "../tmp-dir" ;
@@ -32,6 +31,7 @@ import { Credentials } from "../common/authentication";
3231import { AppCommandManager } from "../common/commands" ;
3332import { allowHttp } from "../config" ;
3433import { showAndLogInformationMessage } from "../common/logging" ;
34+ import { AppOctokit } from "../common/octokit" ;
3535
3636/**
3737 * Prompts a user to fetch a database from a remote location. Database is assumed to be an archive file.
@@ -186,7 +186,7 @@ export async function downloadGitHubDatabase(
186186
187187 const octokit = credentials
188188 ? await credentials . getOctokit ( )
189- : new Octokit . Octokit ( { retry } ) ;
189+ : new AppOctokit ( ) ;
190190
191191 const result = await convertGithubNwoToDatabaseUrl (
192192 nwo ,
You can’t perform that action at this time.
0 commit comments