Skip to content

Conversation

@findepi
Copy link

@findepi findepi commented Nov 27, 2025

This is supposed to be CloudFlare specific 522 Connection timed out HTTP error code.

Description:

Extend the list of HTTP error codes on which network communication is retried, by adding 522 to ot.

Related issue:

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@findepi findepi requested a review from a team as a code owner November 27, 2025 07:55
Copilot AI review requested due to automatic review settings November 27, 2025 07:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the retry mechanism for network errors by adding CloudFlare's HTTP 522 (Connection timed out) status code to the list of retryable error codes.

  • Adds HTTP 522 to the array of retryable HTTP status codes alongside existing codes (429, 502, 503, 504)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

(error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
[429, 502, 503, 504, 522].includes(error.httpStatusCode)) ||
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of HTTP 522 to the retryable status codes is appropriate, but there's no test coverage for the retry logic with HTTP status codes. Consider adding tests to verify that HTTP 522 (and other retryable status codes like 502, 503, 504) trigger the retry mechanism correctly. This would help prevent regressions and document the expected behavior.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there existing test that i should extend that covers existing retries?

@priyagupta108
Copy link
Contributor

Hello @findepi 👋,
Thank you for your pull request. Could you please run the npm run build command to regenerate dist directory. If you need any help feel free to ping us.

This is supposed to be CloudFlare specific 522 Connection timed out HTTP
error code.
@findepi findepi force-pushed the findepi/retry-on-http-522-connection-timed-out-4feab8 branch from 62de876 to ea2712f Compare December 8, 2025 08:51
@findepi
Copy link
Author

findepi commented Dec 8, 2025

@priyagupta108 i run npm install and npm run build.
This resulted in dist/ changes as expected, but also modified package-lock.json. Should i revert changes in package-lock.json?

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.

setup-java sometimes fails with Trying to resolve the latest version from remote Error: error code: 522

2 participants