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

Added custom retry codes configuration options (#1569) #1570

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

janssen-tiobe
Copy link

@janssen-tiobe janssen-tiobe commented Oct 24, 2023

Fixes #1569.

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.

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 janssen-tiobe requested a review from a team as a code owner October 24, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom retry codes for @actions/http-client
3 participants