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 a lazy refresh #772

Merged
merged 1 commit into from
Apr 15, 2024
Merged

feat: add support for a lazy refresh #772

merged 1 commit into from
Apr 15, 2024

Conversation

enocom
Copy link
Member

@enocom enocom commented Apr 15, 2024

When creating a Dialer with the WithLazyRefresh option, the connection info and ephemeral certificate will be refreshed only when the cache certificate has expired. No background goroutines run with this option, making it ideal for use in Cloud Run and other serverless environments where the CPU may be throttled.

Fixes #770

When creating a Dialer with the WithLazyRefresh option, the connection
info and ephemeral certificate will be refreshed only when the cache
certificate has expired. No background goroutines run with this option,
making it ideal for use in Cloud Run and other serverless environments
where the CPU may be throttled.
@enocom enocom requested a review from a team as a code owner April 15, 2024 17:58
@@ -42,6 +42,7 @@ type dialerConfig struct {
refreshTimeout time.Duration
useIAMAuthN bool
logger debug.Logger
lazyRefresh bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want this as lazyRefresh or refreshType? do we see a future where we add another option for refreshes?

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed elsewhere, we're keeping this field unexported so we can adapt it in the future if needed.

@enocom enocom merged commit 931150f into main Apr 15, 2024
13 checks passed
@enocom enocom deleted the lazy-refresh branch April 15, 2024 20:11
enocom added a commit to GoogleCloudPlatform/alloydb-go-connector that referenced this pull request Apr 30, 2024
When creating a Dialer with the WithLazyRefresh option, the connection
info and ephemeral certificate will be refreshed only when the cache
certificate has expired. No background goroutines run with this option,
making it ideal for use in Cloud Run and other serverless environments
where the CPU may be throttled.

This is a port of
GoogleCloudPlatform/cloud-sql-go-connector#772

Fixes #549
enocom added a commit to GoogleCloudPlatform/alloydb-go-connector that referenced this pull request May 1, 2024
When creating a Dialer with the WithLazyRefresh option, the connection
info and ephemeral certificate will be refreshed only when the cache
certificate has expired. No background goroutines run with this option,
making it ideal for use in Cloud Run and other serverless environments
where the CPU may be throttled.

This is a port of
GoogleCloudPlatform/cloud-sql-go-connector#772

Fixes #549
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.

Add support for a lazy refresh
2 participants