From 4558a6a807ad9a86b683ac4fee733786bfb48e39 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Sat, 11 Jan 2025 17:29:18 +0900 Subject: [PATCH] chore: remove throttle octokit --- src/github/github-client.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/github/github-client.ts b/src/github/github-client.ts index b3d6ced..9db6883 100644 --- a/src/github/github-client.ts +++ b/src/github/github-client.ts @@ -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) { @@ -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); });