Skip to content

Commit

Permalink
chore: remove throttle octokit
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 11, 2025
1 parent bfd525f commit 4558a6a
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/github/github-client.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Octokit } from "@octokit/core";
import { requestLog } from "@octokit/plugin-request-log";
import { RequestOptions } from "@octokit/types";
// import { RequestOptions } from "@octokit/types";
import { paginateRest } from "@octokit/plugin-paginate-rest";
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
// import { retry } from "@octokit/plugin-retry";
import { throttling } from "@octokit/plugin-throttling";
// import { throttling } from "@octokit/plugin-throttling";
import { createAppAuth } from "@octokit/auth-app";

const defaultOptions = {
authStrategy: createAppAuth,
throttle: {
onAbuseLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
octokit.log.warn(`Abuse limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
},
onRateLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
octokit.log.warn(`Rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
},
onSecondaryRateLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
octokit.log.warn(`Secondary rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
},
},
// throttle: {
// onAbuseLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
// octokit.log.warn(`Abuse limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
// return true;
// },
// onRateLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
// octokit.log.warn(`Rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
// return true;
// },
// onSecondaryRateLimit: (retryAfter: number, options: RequestOptions, octokit: Octokit) => {
// octokit.log.warn(`Secondary rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
// return true;
// },
// },
};

// function requestLogging(octokit: Octokit) {
Expand All @@ -47,6 +47,6 @@ const defaultOptions = {
// });
// }

export const customOctokit = Octokit.plugin(throttling, paginateRest, restEndpointMethods, requestLog).defaults((instanceOptions: object) => {
export const customOctokit = Octokit.plugin(paginateRest, restEndpointMethods, requestLog).defaults((instanceOptions: object) => {
return Object.assign({}, defaultOptions, instanceOptions);
});

0 comments on commit 4558a6a

Please sign in to comment.