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 failed IP lookup #389

Conversation

rhatgadkar-goog
Copy link
Collaborator

@rhatgadkar-goog rhatgadkar-goog commented Nov 12, 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.

@rhatgadkar-goog rhatgadkar-goog linked an issue Nov 12, 2024 that may be closed by this pull request
@rhatgadkar-goog rhatgadkar-goog changed the title WIP: feat: invalidate cache on bad connections feat: invalidate cache on bad connections Nov 14, 2024
@rhatgadkar-goog rhatgadkar-goog marked this pull request as ready for review November 14, 2024 00:15
@rhatgadkar-goog rhatgadkar-goog requested a review from a team as a code owner November 14, 2024 00:15
Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

Couple small cleanups, otherwise looks great!

Also let's make sure to add a PR description as this work is non-trivial.

google/cloud/alloydb/connector/async_connector.py Outdated Show resolved Hide resolved
google/cloud/alloydb/connector/connector.py Outdated Show resolved Hide resolved
tests/unit/mocks.py Outdated Show resolved Hide resolved
tests/unit/mocks.py Outdated Show resolved Hide resolved
tests/unit/test_async_connector.py Outdated Show resolved Hide resolved
tests/unit/test_async_connector.py Show resolved Hide resolved
Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

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

LGTM. I'll wait for you to address Jack's comments and am happy to approve.

@rhatgadkar-goog rhatgadkar-goog changed the title feat: invalidate cache on bad connections feat: invalidate cache on bad connection info and failed IP lookup Nov 15, 2024
Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

one nit: otherwise LGTM 👏

tests/unit/test_connector.py Outdated Show resolved Hide resolved
tests/unit/test_connector.py Outdated Show resolved Hide resolved
@rhatgadkar-goog rhatgadkar-goog merged commit e8fbbdf into main Nov 16, 2024
15 checks passed
@rhatgadkar-goog rhatgadkar-goog deleted the 265-failed-connection-calls-should-stop-the-background-refresh branch November 16, 2024 00:17
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 stop the background refresh
3 participants