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

update:Improve Timeout Detection in Network Requests #43548

Conversation

yuzhiqiang1993
Copy link

@yuzhiqiang1993 yuzhiqiang1993 commented Mar 19, 2024

Improve Timeout Detection in Network Requests

Summary:

This PR aims to enhance the detection mechanism for request timeouts in the network layer of React Native. The existing implementation only considers SocketTimeoutException for marking a request as timed out. However, this approach misses scenarios where timeouts might occur due to other reasons that manifest as InterruptedIOException with a specific message indicating a timeout. The proposed changes ensure that the application accurately flags such timeout occurrences, providing a more reliable and comprehensive handling of timeout conditions.

Changelog:

[Android] [Changed] [NetworkModule] - Expand timeout detection to include InterruptedIOException alongside SocketTimeoutException, improving reliability in identifying request timeouts.

Test Plan:

Before Changes: The timeout detection was limited to SocketTimeoutException, which did not cover all possible timeout scenarios. As a result, certain timeout conditions could pass unnoticed, leading to inconsistent behavior in network error handling.
After Changes: The detection has been expanded to include instances of InterruptedIOException with a message indicating a timeout, alongside the original SocketTimeoutException. This broader approach allows for a more accurate identification of timeout-related errors.
Testing was performed by simulating both SocketTimeoutException and InterruptedIOException with a "timeout" message. The updated logic successfully flagged both instances as timeouts, demonstrating the effectiveness of the proposed enhancement.

@facebook-github-bot
Copy link
Contributor

Hi @yuzhiqiang1993!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 19, 2024
@react-native-bot
Copy link
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 16, 2024
@react-native-bot
Copy link
Collaborator

This PR was closed because it has been stalled for 7 days with no activity.

@react-native-bot react-native-bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants