Skip to content

Commit

Permalink
fix(types): created 'Groups' type
Browse files Browse the repository at this point in the history
  • Loading branch information
oscard0m committed Mar 10, 2022
1 parent 596782e commit d7659c8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/index.ts
Expand Up @@ -7,6 +7,7 @@ import {
ThrottlingOptionsBase,
AbuseLimitHandler,
SecondaryLimitHandler,
Groups,
} from "./types";
import { VERSION } from "./version";

Expand All @@ -18,31 +19,27 @@ import { routeMatcher } from "./route-matcher";
const regex = routeMatcher(triggersNotificationPaths);
const triggersNotification = regex.test.bind(regex);

const groups = {};
const groups: Groups = {};

// @ts-expect-error
const createGroups = function (Bottleneck, common) {
// @ts-expect-error
groups.global = new Bottleneck.Group({
id: "octokit-global",
maxConcurrent: 10,
...common,
});
// @ts-expect-error
groups.search = new Bottleneck.Group({
id: "octokit-search",
maxConcurrent: 1,
minTime: 2000,
...common,
});
// @ts-expect-error
groups.write = new Bottleneck.Group({
id: "octokit-write",
maxConcurrent: 1,
minTime: 1000,
...common,
});
// @ts-expect-error
groups.notifications = new Bottleneck.Group({
id: "octokit-notifications",
maxConcurrent: 1,
Expand Down Expand Up @@ -72,7 +69,6 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) {
}
const common = { connection, timeout };

// @ts-expect-error
if (groups.global == null) {
createGroups(Bottleneck, common);
}
Expand Down

0 comments on commit d7659c8

Please sign in to comment.