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

r11s-driver: fix offline reconnect #10378

Merged
merged 1 commit into from
May 20, 2022
Merged

Conversation

znewton
Copy link
Contributor

@znewton znewton commented May 20, 2022

Transitioning to offline does not overtly fail reconnect attempt, causing reconnect to delay by up to 22 seconds #10325

For more information about how to contribute to this repo, visit this page

Description

The reconnect_attempt event from Socket.io does not fire in offline scenario for some reason. Rather than figuring out how/why this is not reliable, we can just switch to counting connect_error events, which are reliable.

Steps to Reproduce Bug and Validate Solution

Only applicable if the work is to address a bug. Please remove this section if the work is for a feature or story
Provide details on the environment the bug is found, and detailed steps to recreate the bug.
This should be detailed enough for a team member to confirm that the bug no longer occurs

  1. Run an example app (e.g. Clicker)
  2. Open dev tools, Network tab, then switch from No Throttling to Offline
  3. After WS connection fails, switch back to NoThrottling
  4. See delay of up to 22 seconds

PR Checklist

Use the check-list below to ensure your branch is ready for PR. If the item is not applicable, leave it blank.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code follows the code style of this project.
  • I ran the lint checks which produced no new errors nor warnings for my changes.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.

Does this introduce a breaking change?

  • Yes
  • No

If this introduces a breaking change, please describe the impact and migration path for existing applications below.

Testing

  • Instructions for testing and validation of your code so the reviewer can follow those steps and validate code works as expected

Follow above repro steps. Instead of seeing a delay on reconnect, you can see it reconnects immediately.

Additionally, by adding a breakpoint in the connect_error listener you can see it fail overtly after the 2nd connect_error when offline.

Any relevant logs or outputs

  • Use this section to provide either screenshots or output of logs as code snippets

Other information or known dependencies

  • Any other information or known dependencies that is important to this PR.
  • TODO that are to be done after this PR.

Fixes #10325

@znewton znewton requested a review from a team as a code owner May 20, 2022 22:22
@github-actions github-actions bot added area: driver Driver related issues base: main PRs targeted against main branch labels May 20, 2022
Copy link
Contributor

@ChumpChief ChumpChief left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix!

@znewton znewton merged commit 75ea2b3 into microsoft:main May 20, 2022
@znewton znewton deleted the offline-reconnect branch May 20, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: driver Driver related issues base: main PRs targeted against main branch
Projects
None yet
3 participants