dataconnect(chore): RealtimeQueryManager.kt added with basic logic to multiplex connection stream#8158
dataconnect(chore): RealtimeQueryManager.kt added with basic logic to multiplex connection stream#8158dconeybe wants to merge 9 commits into
Conversation
…one coroutine accessing it
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. |
📝 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. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the RealtimeQueryManager to handle realtime query subscriptions, deduplicate identical queries, and manage the lifecycle of bidirectional gRPC streams. It also refactors DataConnectBidiConnectStream to support multiple subscribers via a new SubscriptionStateManager. Feedback highlights critical issues including a potential permanent lock-out in the Connecting state upon failure, a lack of connection health monitoring for active streams, and an unbounded memory leak in the query deduplication map. Additionally, a bug in the logging initialization within FirebaseDataConnectImpl was identified.
Added
RealtimeQueryManagerto manage and deduplicate bidirectional gRPC stream connections for Data Connect realtime queries.Highlights
RealtimeQueryManagerto handle the lifecycle of bidirectional gRPC streams and multiplex multiple queries over a single connection.DataConnectBidiConnectStreamto use aSubscriptionStateManagerfor improved tracking and management of individual query subscriptions.RealtimeQuerySubscriptionImplUnitTestproviding extensive test coverage for connection sharing, message decoding, and error handling.TurbineUtils.ktwithTurbinePredicateResultand improvedawaitUntilItemlogic for more robust flow testing.RealtimeTodo.mdto document and track critical future enhancements, such as connection health monitoring and resource leak fixes.Changelog
10 files affected
SubscriptionStateManagerand updated the subscription flow logic.OperationNameVariablesPairto a shared test utility.testutil.TurbinePredicateResult.