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: add support for lazy refresh strategy #1093

Merged
merged 9 commits into from
May 30, 2024
Merged

Conversation

jackwotherspoon
Copy link
Collaborator

@jackwotherspoon jackwotherspoon commented May 30, 2024

Add refresh_strategy argument to Connector() that allows setting
the strategy to "lazy" to use a lazy refresh strategy.

When creating a Connector via Connector(refresh_strategy="lazy"),
the connection info and ephemeral certificate will be refreshed only
when the cache certificate has expired. No background tasks run
periodically with this option, making it ideal for use in serverless
environments such as Cloud Run, Cloud Functions, etc, where the
CPU may be throttled.

Usage example:

from google.cloud.sql.connector import Connector

with Connector(refresh_strategy="lazy") as connector:
    # ... use connector in lazy refresh mode

@jackwotherspoon jackwotherspoon self-assigned this May 30, 2024
@jackwotherspoon jackwotherspoon changed the title WIP: add support for LazyRefreshCache via refresh_strategy WIP: add support for lazy refresh strategy May 30, 2024
@jackwotherspoon jackwotherspoon changed the title WIP: add support for lazy refresh strategy feat: add support for lazy refresh strategy May 30, 2024
@jackwotherspoon jackwotherspoon marked this pull request as ready for review May 30, 2024 18:45
@jackwotherspoon jackwotherspoon requested a review from a team as a code owner May 30, 2024 18:45
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.

🚢

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.

2 participants