update:Improve Timeout Detection in Network Requests#43548
update:Improve Timeout Detection in Network Requests#43548yuzhiqiang1993 wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Hi @yuzhiqiang1993! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
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. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
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.