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

Custom retry codes for @actions/http-client #1569

Open
janssen-tiobe opened this issue Oct 24, 2023 · 0 comments · May be fixed by #1570
Open

Custom retry codes for @actions/http-client #1569

janssen-tiobe opened this issue Oct 24, 2023 · 0 comments · May be fixed by #1570
Labels
enhancement New feature or request

Comments

@janssen-tiobe
Copy link

We use the @actions/http-client to be able to easily retry http requests on failed requests.
The problem is that currently only 502, 503 and 504 are retried, but in our implementation we also need 500 to be retried.

I want to propose a mechanism where retry codes can be added or removed by the user by appending the RequestOptions with retryOnCodes and noRetryOnCodes to have the full controll on what statuscodes should be retried and not.

@janssen-tiobe janssen-tiobe added the enhancement New feature or request label Oct 24, 2023
janssen-tiobe added a commit to janssen-tiobe/actions-toolkit that referenced this issue Oct 24, 2023
Extended the `RequestOptions` interface with `retryCodes` and `noRetryCodes` options, added the implementation for that in `index.js` by creating the function `_shouldRetryOnCode`, which has the hierarchy `retryCodes` > `noRetryCodes` > `DefaultHttpResponseRetryCodes`. Also fixed the failing unit tests by updating the imports (can be reverted if that was not needed, but in my case it was) and wrote new unit tests for the retry mechanism. Wrote the unit tests by adding the variable `retryCount` to `HttpClientResponse` to be able to track the amount of retries done. This is also very usefull for logging in production, as there is no current method for that.
janssen-tiobe added a commit to janssen-tiobe/actions-toolkit that referenced this issue Oct 24, 2023
Extended the `RequestOptions` interface with `retryCodes` and `noRetryCodes` options, added the implementation for that in `index.js` by creating the function `_shouldRetryOnCode`, which has the hierarchy `retryCodes` > `noRetryCodes` > `DefaultHttpResponseRetryCodes`. Also fixed the failing unit tests by updating the imports (can be reverted if that was not needed, but in my case it was) and wrote new unit tests for the retry mechanism. Wrote the unit tests by adding the variable `retryCount` to `HttpClientResponse` to be able to track the amount of retries done. This is also very usefull for logging in production, as there is no current method for that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant