Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not retry status code 451 by default #447

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# plugin-retry.js

> Retries requests for server 4xx/5xx responses except `400`, `401`, `403`, `404`, and `422`.
> Retries requests for server 4xx/5xx responses except `400`, `401`, `403`, `404`, `422`, and `451`.

[![@latest](https://img.shields.io/npm/v/@octokit/plugin-retry.svg)](https://www.npmjs.com/package/@octokit/plugin-retry)
[![Build Status](https://github.com/octokit/plugin-retry.js/workflows/Test/badge.svg)](https://github.com/octokit/plugin-retry.js/actions?workflow=Test)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function retry(octokit: Octokit, octokitOptions: any) {
{
enabled: true,
retryAfterBaseValue: 1000,
doNotRetry: [400, 401, 403, 404, 422],
doNotRetry: [400, 401, 403, 404, 422, 451],
retries: 3,
},
octokitOptions.retry
Expand Down
6 changes: 3 additions & 3 deletions test/retry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ describe("Automatic Retries", function () {
expect(ms2).toBeGreaterThan(420);
});

it("Should not retry 3xx/400/401/403/422 errors", async function () {
it("Should not retry 3xx/400/401/403/422/451 errors", async function () {
const octokit = new TestOctokit({ retry: { retryAfterBaseValue: 50 } });
let caught = 0;
const testStatuses = [304, 400, 401, 403, 404, 422];
const testStatuses = [304, 400, 401, 403, 404, 422, 451];

for (const status of testStatuses) {
try {
Expand Down Expand Up @@ -241,7 +241,7 @@ describe("Automatic Retries", function () {
},
});
let caught = 0;
const testStatuses = [304, 400, 401, 403, 404];
const testStatuses = [304, 400, 401, 403, 404, 422, 451];

for (const status of testStatuses) {
try {
Expand Down