| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…f onTokenChanged() is called synchronously from getToken() [no ci]
|
Using Gemini Code Assist
The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here. 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. |
Sorry, something went wrong.
|
/gemini review |
Sorry, something went wrong.
📝 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. |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request addresses an infinite loop issue that occurred when Auth and/or App Check tokens were refreshed. It refactors the onTokenChanged method in DataConnectCredentialsTokenManager to await the active token job and verify if the new token is actually different before triggering a new token retrieval, rather than unconditionally cancelling and retrying. Unit tests were updated accordingly, including a new test verifying synchronous calls. The review feedback suggests simplifying a nested fold structure in the refactored onTokenChanged method using Kotlin's safe call and Elvis operators to improve readability.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR resolves a potential infinite loop of cancellations and retries in Data Connect that could occur in DataConnectCredentialsTokenManager if an auth or App Check token change notification was triggered synchronously during an active token fetch. Instead of immediately cancelling the active job when a token change is detected, the manager now awaits its completion and inspects the result to determine if the expected token has already been retrieved.
Highlights
- Awaits active jobs instead of cancelling: Refactored onTokenChanged() to await the in-flight getToken() job rather than cancelling it immediately. This prevents a cascade of cancellation-retry loops when token notifications are synchronous.
- Reuse of successful fetches: If the completed job returns the newly notified token, no further calls are made, reducing the total calls to the provider's getAccessToken() to exactly 1.
- Updated unit tests: Replaced the cancellation-behavior test with a synchronous-refresh test to verify that calling onTokenChanged during a fetch doesn't result in redundant provider calls.
Changelog