-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bump minimal retry in case of secondary rate limiting to 60s (#594)
- Loading branch information
Showing
5 changed files
with
102 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Octokit } from "@octokit/core"; | ||
import { throttling } from "../src"; | ||
|
||
const TestOctokit = Octokit.plugin(throttling); | ||
|
||
describe("deprecations", () => { | ||
it("throttle.minimalSecondaryRateRetryAfter option", () => { | ||
const log = { | ||
warn: jest.fn(), | ||
}; | ||
new TestOctokit({ | ||
// @ts-expect-error | ||
log, | ||
throttle: { | ||
minimalSecondaryRateRetryAfter: 1, | ||
onSecondaryRateLimit: () => 1, | ||
onRateLimit: () => 1, | ||
}, | ||
}); | ||
|
||
expect(log.warn).toHaveBeenCalledWith( | ||
"[@octokit/plugin-throttling] `options.throttle.minimalSecondaryRateRetryAfter` is deprecated, please use `options.throttle.fallbackSecondaryRateRetryAfter` instead" | ||
); | ||
}); | ||
|
||
describe("throttle.onAbuseLimit", function () { | ||
it("Should detect SecondaryRate limit and broadcast event", async function () { | ||
const log = { | ||
warn: jest.fn(), | ||
}; | ||
|
||
new TestOctokit({ | ||
// @ts-expect-error | ||
log, | ||
throttle: { | ||
onAbuseLimit: () => 1, | ||
onRateLimit: () => 1, | ||
}, | ||
}); | ||
|
||
expect(log.warn).toHaveBeenCalledWith( | ||
"[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead" | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.