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

feat: invalidate cache on bad connection info and IP lookup #1118

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

jackwotherspoon
Copy link
Collaborator

@jackwotherspoon jackwotherspoon commented Jun 25, 2024

The Connector caches connection info for future connections and
schedules refresh operations, however for unrecoverable errors/state
we should invalidate the cache to stop future bad refreshes.

We should invalidate the cache on all failed calls to the Cloud SQL Admin
APIs, as well as failed IP lookup (preferred IP does not exist).

Added a ._remove_cached method to the Connector to facilitate
invalidating the cache.

Closes #1098

@jackwotherspoon jackwotherspoon self-assigned this Jun 25, 2024
@jackwotherspoon jackwotherspoon requested a review from a team as a code owner June 25, 2024 16:19
@jackwotherspoon jackwotherspoon changed the title feat: invalidate cache on bad connections feat: invalidate cache on bad connection info and IP lookup Jun 25, 2024
@jackwotherspoon jackwotherspoon merged commit 672dc4e into main Jun 25, 2024
15 checks passed
@jackwotherspoon jackwotherspoon deleted the invalidate-cache branch June 25, 2024 17:21
rhatgadkar-goog added a commit to GoogleCloudPlatform/alloydb-python-connector that referenced this pull request Nov 16, 2024
)

This change is analogous to CloudSQL's GoogleCloudPlatform/cloud-sql-python-connector#1118.

The Connector caches connection info for future connections and schedules refresh operations. For unrecoverable errors, the cache should be invalidated to stop future bad refreshes. The cache should also be invalidated on failed IP lookups. This PR does these things.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed connection calls should invalidate the cache
2 participants