dataconnect(change): Exponential backoff in realtime query subscription reconnection now eagerly retries when network status changes#8446
Conversation
…ctFactory to DataConnectBidiConnectStream
… connection restored events
…eing reset in response to network connectivity restored events.
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces network connectivity monitoring to eagerly retry connections when network connectivity is restored, bypassing the full exponential backoff duration. It propagates a networkConnectivityRestoredFlow through the connection stream, gRPC RPCs, and factory classes, and adds corresponding unit tests. Feedback points out a potential issue in DataConnectBidiConnectStream where catching Throwable can swallow CancellationException and break structured concurrency; it is recommended to catch and rethrow CancellationException explicitly.
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
This PR integrates data connect's network status monitoring with the exponential backoff reconnection strategy for realtime query subscriptions. It ensures that when network connectivity is restored, the client immediately aborts any active retry delays and triggers a reconnection attempt using the initial backoff wait time.
This is a follow-up PR to #8421 that completes the network-status-triggered reconnection flow.
Highlights
networkConnectivityRestoredFlowfromFirebaseDataConnectFactorythroughFirebaseDataConnectImplandDataConnectGrpcRPCsdown toDataConnectBidiConnectStream.Changelog
networkConnectivityRestoredFlowto reset theretryBackoffand trigger an immediate reconnect upon network restoration.networkConnectivityRestoredFlow.networkConnectivityRestoredFlowdown to the data connect implementation.networkConnectivityRestoredFlow.signalOnRetryForTestingto intercept and signal backoff retry triggers during testing.networkConnectivityRestoredFlowinto the testing instance.network connectivity restoration resets retries immediatelyunit test.network connectivity restoration resets backoff delay to initial valueunit test.getExpectedBackoffWaitTimes.